| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 4 초 | 1024 MB | 140 | 11 | 8 | 7.477% |
Despite running low on oil, the opening ceremony was a great success.* Now, the committee is looking forward to the first competition day. But what’s this? The chairman of the Technical Committee noticed some suspicious network activity—apparently someone is planning to hack the grading server!
The grading server possesses a specific computing power $c_G$ which the mysterious hacker will try to reduce to (or below) 0ドル$. But the server is also protected by $f_G$ firewalls, each of which will reduce the impact of any attack by a fixed amount $S$. At each point in time, the hacker can now decide to either
However, the chairman can strike back by either taking down one of the hacker’s $f_H$ firewalls or by using the grading server’s computing power to attack the hacker, which will similarly reduce $c_H$ by $\max \{c_G - f_H \cdot S, 0\}$. The chairman and the hacker take turns in their actions, with the hacker going first.
The committee will not know how much computing power and how many firewalls the hacker possesses until the hack has started. At the same time, because the committee might still be able to upgrade the server, its computing power and the number of its firewalls are also still unknown. To plan their defense, the committee therefore needs a program that tells them for $Q$ different scenarios $(c_H , f_H , c_G , f_G )$ whether the hacker can bring down the grading server even if the chairman makes optimal decisions.
* At least if one ignores the grand finale with the stage collapsing under the weight of 10ドル^{17}$ performers.
The first line of the input contains the integers $S$ and $Q$. Then $Q$ lines follow, each of which describes a scenario as above and consists of four integers $c_H$ $f_H$ $c_G$ $f_G$: the computing power and number of firewalls of the mysterious hacker and of the grading server, respectively.
Your program should output $Q$ lines, each of which should consist of a single string: YES if the hacker can reduce the grading server’s computing power to or below 0ドル$ in the corresponding scenario (regardless of the chairman’s actions), and NO otherwise.
We always have 1ドル ≤ S ≤ 30,000円,ドル 1ドル ≤ c_H , c_G ≤ 10^{12},ドル 0ドル ≤ f_H , f_G ≤ 10^{12},ドル and 1ドル ≤ Q ≤ 250,000円$.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 5 | $S, c_H , f_H , c_G , f_G ≤ 75$ |
| 2 | 5 | $S, c_H , f_H , c_G , f_G ≤ 300$ |
| 3 | 10 | $S = 1$ |
| 4 | 25 | $S, c_H , f_H , c_G , f_G ≤ 2,000円$ |
| 5 | 20 | $S = 400$ |
| 6 | 20 | $f_G , f_H ≤ 125$ |
| 7 | 15 | No further constraints. |
17 2 42 1 33 1 42 1 33 7
YES NO
1 1 999999999999 999999999999 999999999999 999999999999
YES
2 1 1000000000000 0 1 1000000000000
NO
Consider the first scenario of the first example:
In the second scenario on the other hand: