#P9730. [CEOI 2023] Grading Server
[CEOI 2023] Grading Server
Background
Translated from CEOI 2023 Day 1 T2 Grading Server.
Problem Description
The president of the contest committee has noticed some suspicious network activity—someone is trying to attack the grading system!
The grading system has a certain computing power . The hacker will try to reduce to (or even lower). The system is protected by firewalls, and each firewall reduces the effect of an attack by .
At each moment, the hacker can perform one of the following two actions:
- Break one firewall, decreasing by (but not below ), or
- Attack the system with all his computing power , decreasing by .
But the committee president can fight back: break one of the hacker’s firewalls; or attack the hacker using the system’s computing power, similarly decreasing by . The committee president and the hacker take turns, and the hacker moves first.
To plan the defense, the committee members need a program that tells them, for different cases , whether the hacker can still take down the grading system (reduce to or below) even if the committee president plays optimally.
Input Format
The first line contains two integers .
The next lines each contain four integers describing one case: the hacker’s computing power and number of firewalls, and the grading system’s computing power and number of firewalls.
Output Format
Your program should output lines, each containing a string YES or NO. Output YES if, no matter what the committee president does, a hacker who plays optimally can always reduce to or below; otherwise output NO.
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
Hint
Sample Explanation
Consider the first case in the sample:
- First, the hacker attacks the grading system, decreasing by to ;
- Next, the committee president cannot reduce by attacking, so the wise choice is to break the hacker’s only firewall;
- However, the hacker can keep attacking the grading system, decreasing by to , taking down the grading system and ruining Day 1 of the contest.
For the second case:
- At the start, the only thing the hacker can do is to break one firewall of the grading system;
- Next, the committee president attacks the hacker, decreasing to ;
- In the next two rounds, the hacker can again only attack the grading system’s firewalls. Meanwhile, each time the committee president attacks the hacker, decreasing to a value not greater than , successfully defending against the hacker’s attack.
Constraints and Notes
- Subtask 1 (5 points): ;
- Subtask 2 (5 points): ;
- Subtask 3 (10 points): ;
- Subtask 4 (25 points): ;
- Subtask 5 (20 points): ;
- Subtask 6 (20 points): ;
- Subtask 7 (15 points): No additional constraints.
For all testdata, , , , .
Limits
Time: 4s.
Memory: 1GB.
Translated by ChatGPT 5