当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5214:Movie

题目描述
Cloud and Miceren like watching movies.

Today, they want to choose some wonderful scenes from a movie. A movie has $N$ scenes can be chosen, and each scene is associate with an interval [$L$, $R$]. $L$ is the beginning time of the scene and $R$ is the ending time. However, they can't choose two scenes which have overlapping intervals. (For example, scene with [1, 2] and scene with [2, 3], scene with [2, 5] and scene with[3, 4]).

Now, can you tell them if they can choose such three scenes that any pair of them do not overlap?

Since there are so many scenes that you can't get them in time, we will give you seven parameters $N,~L_1,~R_1,~a,~b,~c,~d$, and you can generate $L_1$ ~ $L_N$, $R_1$ ~ $R_N$ by these parameters.
输入解释
The first line contains a single integer $T$, indicating the number of test cases.

Each test case contains seven integers $N,~L_1,~R_1,~a,~b,~c,~d$, meaning that there are $N$ scenes. The i-th scene's interval is [$L_i,~R_i$]. $L_1$ and $R_1$ have been stated in input, and $L_i~=~(L_{i - 1}~*~a~+~b)~mod~4294967296,~R_i~=~(R_{i - 1}~*~c~+~d)~mod~4294967296$.

After all the intervals are generated, swap the i-th interval's $L_i$ and $R_i$ if $L_i~>~R_i$.


$T$ is about 100.

$1~\le~N~\le~10000000$.

$1~\le~L_1, R_1~\le~2000000000$.

$1~\le~a, b, c, d~\le~1000000000$.

The ratio of test cases with $N~\gt~100$ is less than 5%.
输出解释
For each test, print one line.

If they can choose such three scenes, output "YES", otherwise output "NO".
输入样例
2
3 1 4 1 1 1 1
3 1 4 4 1 4 1
输出样例
NO
YES
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5214

最后修改于 2020-10-25T23:20:45+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
14000/7000MS(Java/Others) 131072/131072K(Java/Others)