Logo
(追記) (追記ここまで)

29776번 - Bring Down the (削除) Sky (削除ここまで) Grading Server 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 1024 MB1401187.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

  • take down one of these firewalls, permanently reducing $f_G$ by 1ドル$ (down to a minimum of 0ドル$), or
  • use all of their own computing power $c_H$ to attack the server, permanently reducing $c_G$ by $\max \{c_H - f_G \cdot S, 0\}$.

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円$.

번호배점제한
15

$S, c_H , f_H , c_G , f_G ≤ 75$

25

$S, c_H , f_H , c_G , f_G ≤ 300$

310

$S = 1$

425

$S, c_H , f_H , c_G , f_G ≤ 2,000円$

520

$S = 400$

620

$f_G , f_H ≤ 125$

715

No further constraints.

예제 입력 1

17 2
42 1 33 1
42 1 33 7

예제 출력 1

YES
NO

예제 입력 2

1 1
999999999999 999999999999 999999999999 999999999999

예제 출력 2

YES

예제 입력 3

2 1
1000000000000 0 1 1000000000000

예제 출력 3

NO

힌트

Consider the first scenario of the first example:

  • In the beginning, the hacker can attack the grading server, reducing $c_G$ by 42ドル - 1 \cdot 17 = 25$ to a new value of 8ドル$.
  • Afterwards, the chairman cannot reduce the hacker’s computing power by attacking, so the only sensible thing for him to do is to take down the hacker’s unique firewall.
  • However, the hacker can then reduce the computing power of the grading server to 8ドル - 25 = -17 ≤ 0$ by another attack, bringing down the server and ruining the first competition day.

In the second scenario on the other hand:

  • Initially, the only thing the hacker can do is to take down one of the firewalls.
  • Afterwards, the chairman can attack the hacker, reducing their computing power $c_H$ to 26ドル$.
  • In the next two rounds, the hacker again can only take down one of the firewalls, while the chairman can attack each time, thus reducing $c_H$ below 0ドル$ and successfully fighting off the hacker’s attempt.

출처

Olympiad > Central European Olympiad in Informatics > CEOI 2023 > Day 1 2번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
  • 이 문제의 채점 우선 순위는 2이다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /