QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#524700#7277. Bring Down the Sky Grading ServerDan4Life#0 863ms3584kbC++23831b2024-08-20 02:07:332024-08-20 02:07:34

Judging History

你现在查看的是最新测评结果

  • [2024-08-20 02:07:34]
  • 评测
  • 测评结果:0
  • 用时:863ms
  • 内存:3584kb
  • [2024-08-20 02:07:33]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using ll = long long;
using vi = vector<int>;
using ar2 = array<int,2>;


int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll S; int q; cin >> S >> q;
	for(int _ = 0; _ < q; _++){
		ll CH, FH, CG, FG;
		cin >> CH >> FH >> CG >> FG;
		bool ans = 0;
		for(int fg = 0; fg <= FG; fg++){
			int ok = 1;
			for(int fh = 0; fh <= FH; fh++){
				bool turn = 0, won = 0;
				int ch = CH, cg = CG;
				while(1){
					if(turn){
						ch-=max(0ll,cg-fh*S);
						if(ch<=0) won=1;
					}
					else{
						cg-=max(0ll,ch-fg*S);
						if(cg<=0) break;
					}
					turn^=1;
				}
				ok&=won;
			}
			if(ok) { ans=1; break; }
		}
		cout << (!ans?"YES":"NO") << "\n";
	}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 5
Accepted
time: 863ms
memory: 3584kb

input:

17 2
42 1 33 1
42 1 33 7

output:

YES
NO

result:

ok 2 token(s): yes count is 1, no count is 1

Test #2:

score: 0
Time Limit Exceeded

input:

2 250000
75 16 56 55
50 9 49 60
18 67 62 5
30 54 61 39
22 39 42 31
26 30 55 1
23 30 53 16
55 13 6 44
69 8 58 72
53 7 60 12
29 14 26 34
37 64 24 71
19 3 40 1
64 13 33 65
67 24 68 3
64 17 50 66
71 6 62 13
15 29 26 24
51 30 34 45
46 5 40 72
54 52 60 49
35 21 18 30
39 31 35 34
30 74 72 5
74 12 6 15
11 4...

output:


result:


Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Time Limit Exceeded

Test #28:

score: 0
Time Limit Exceeded

input:

1 250000
554333015044 833858497873 833858497874 554333015044
655160857180 306396306924 306396306917 655160857187
374728598365 176680698490 176680698490 374728598365
764650258714 835600427315 835600427309 764650258720
521594231110 318048536486 318048536482 521594231115
273627794040 449769302710 10899...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #3:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%