답안 #1041864

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041864 2024-08-02T08:51:06 Z 정민찬(#11002) Bring Down the Grading Server (CEOI23_gradingserver) C++17
10 / 100
4000 ms 1048576 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll S, Q;
map<array<ll,4>,bool> dp;

bool go(ll c1, ll f1, ll c2, ll f2, ll l1, ll l2) {
    if (c1 == 0) return false;
    if (c2 == 0) return true;
    if (f2 && c1 >= f2*S && c2 <= f1*S) return true;
    if (c2 + f2*S <= c1) return true;
    if (c1 >= c2 && f1 >= f2) return true;
    if (c1 < f2*S && c2 < f1*S) {
        ll cnt1 = f2 - c1/S;
        ll cnt2 = f1 - c2/S;
        if (cnt1 <= cnt2) {
            return go(c1, f1-cnt1, c2, f2-cnt1, cnt1, cnt1);
        }
        else {
            return !go(c2, f2-cnt2-1, c1, f1-cnt2, cnt2, cnt2+1);
        }
    }
    if (c1 - f2*S >= S) {
        if (f2*S < c1) {
            if (!go(c2-(c1-f2*S), f2, c1, f1, l2, 0))
                return true;
        }
        if (f2 && (c1 <= (f2+1)*S || l1 <= 10)) {
            if (!go(c2, f2-1, c1, f1, l2, l1+1))
                return true;
        }
    }
    else {
        if (f2 && (c1 <= (f2+1)*S || l1 <= 10)) {
            if (!go(c2, f2-1, c1, f1, l2, l1+1))
                return true;
        }
        if (f2*S < c1) {
            if (!go(c2-(c1-f2*S), f2, c1, f1, l2, 0))
                return true;
        }
    }
    return false;
}

int main() {
    ios_base :: sync_with_stdio(false); cin.tie(NULL);
    
    cin >> S >> Q;
    for (ll i=0; i<Q; i++) {
        ll c1, f1, c2, f2;
        cin >> c1 >> f1 >> c2 >> f2;
        if (go(c1, f1, c2, f2, false, false)) {
            cout << "YES\n";
        }
        else cout << "NO\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 452 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 540 ms 1048576 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 157 ms 1084 KB Output is correct
3 Correct 84 ms 1236 KB Output is correct
4 Correct 76 ms 1104 KB Output is correct
5 Correct 71 ms 1108 KB Output is correct
6 Correct 55 ms 1300 KB Output is correct
7 Correct 88 ms 1124 KB Output is correct
8 Correct 70 ms 1272 KB Output is correct
9 Correct 75 ms 1196 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 157 ms 1084 KB Output is correct
3 Correct 84 ms 1236 KB Output is correct
4 Correct 76 ms 1104 KB Output is correct
5 Correct 71 ms 1108 KB Output is correct
6 Correct 55 ms 1300 KB Output is correct
7 Correct 88 ms 1124 KB Output is correct
8 Correct 70 ms 1272 KB Output is correct
9 Correct 75 ms 1196 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 155 ms 1280 KB Output is correct
12 Correct 89 ms 1420 KB Output is correct
13 Correct 51 ms 1108 KB Output is correct
14 Correct 54 ms 1108 KB Output is correct
15 Correct 54 ms 1132 KB Output is correct
16 Correct 89 ms 1104 KB Output is correct
17 Correct 64 ms 1244 KB Output is correct
18 Correct 40 ms 1116 KB Output is correct
19 Correct 2325 ms 3316 KB Output is correct
20 Correct 885 ms 3392 KB Output is correct
21 Correct 116 ms 3228 KB Output is correct
22 Correct 70 ms 3284 KB Output is correct
23 Correct 76 ms 3292 KB Output is correct
24 Correct 73 ms 3424 KB Output is correct
25 Correct 80 ms 3252 KB Output is correct
26 Correct 128 ms 3436 KB Output is correct
27 Correct 75 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 453 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 157 ms 1084 KB Output is correct
3 Correct 84 ms 1236 KB Output is correct
4 Correct 76 ms 1104 KB Output is correct
5 Correct 71 ms 1108 KB Output is correct
6 Correct 55 ms 1300 KB Output is correct
7 Correct 88 ms 1124 KB Output is correct
8 Correct 70 ms 1272 KB Output is correct
9 Correct 75 ms 1196 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 155 ms 1280 KB Output is correct
12 Correct 89 ms 1420 KB Output is correct
13 Correct 51 ms 1108 KB Output is correct
14 Correct 54 ms 1108 KB Output is correct
15 Correct 54 ms 1132 KB Output is correct
16 Correct 89 ms 1104 KB Output is correct
17 Correct 64 ms 1244 KB Output is correct
18 Correct 40 ms 1116 KB Output is correct
19 Correct 2325 ms 3316 KB Output is correct
20 Correct 885 ms 3392 KB Output is correct
21 Correct 116 ms 3228 KB Output is correct
22 Correct 70 ms 3284 KB Output is correct
23 Correct 76 ms 3292 KB Output is correct
24 Correct 73 ms 3424 KB Output is correct
25 Correct 80 ms 3252 KB Output is correct
26 Correct 128 ms 3436 KB Output is correct
27 Correct 75 ms 3412 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 169 ms 1164 KB Output is correct
30 Correct 69 ms 1076 KB Output is correct
31 Correct 49 ms 1116 KB Output is correct
32 Correct 46 ms 1104 KB Output is correct
33 Correct 70 ms 1192 KB Output is correct
34 Correct 64 ms 1268 KB Output is correct
35 Correct 61 ms 1360 KB Output is correct
36 Correct 42 ms 1312 KB Output is correct
37 Correct 2481 ms 1156 KB Output is correct
38 Correct 847 ms 1264 KB Output is correct
39 Correct 104 ms 1360 KB Output is correct
40 Correct 72 ms 1112 KB Output is correct
41 Correct 86 ms 1164 KB Output is correct
42 Correct 64 ms 1324 KB Output is correct
43 Correct 85 ms 1244 KB Output is correct
44 Correct 90 ms 1268 KB Output is correct
45 Correct 105 ms 1244 KB Output is correct
46 Correct 260 ms 1876 KB Output is correct
47 Execution timed out 4077 ms 632 KB Time limit exceeded
48 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 157 ms 1084 KB Output is correct
3 Correct 84 ms 1236 KB Output is correct
4 Correct 76 ms 1104 KB Output is correct
5 Correct 71 ms 1108 KB Output is correct
6 Correct 55 ms 1300 KB Output is correct
7 Correct 88 ms 1124 KB Output is correct
8 Correct 70 ms 1272 KB Output is correct
9 Correct 75 ms 1196 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 155 ms 1280 KB Output is correct
12 Correct 89 ms 1420 KB Output is correct
13 Correct 51 ms 1108 KB Output is correct
14 Correct 54 ms 1108 KB Output is correct
15 Correct 54 ms 1132 KB Output is correct
16 Correct 89 ms 1104 KB Output is correct
17 Correct 64 ms 1244 KB Output is correct
18 Correct 40 ms 1116 KB Output is correct
19 Correct 2325 ms 3316 KB Output is correct
20 Correct 885 ms 3392 KB Output is correct
21 Correct 116 ms 3228 KB Output is correct
22 Correct 70 ms 3284 KB Output is correct
23 Correct 76 ms 3292 KB Output is correct
24 Correct 73 ms 3424 KB Output is correct
25 Correct 80 ms 3252 KB Output is correct
26 Correct 128 ms 3436 KB Output is correct
27 Correct 75 ms 3412 KB Output is correct
28 Runtime error 453 ms 1048576 KB Execution killed with signal 9
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 157 ms 1084 KB Output is correct
3 Correct 84 ms 1236 KB Output is correct
4 Correct 76 ms 1104 KB Output is correct
5 Correct 71 ms 1108 KB Output is correct
6 Correct 55 ms 1300 KB Output is correct
7 Correct 88 ms 1124 KB Output is correct
8 Correct 70 ms 1272 KB Output is correct
9 Correct 75 ms 1196 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 156 ms 1092 KB Output is correct
12 Correct 69 ms 1312 KB Output is correct
13 Correct 53 ms 1364 KB Output is correct
14 Correct 50 ms 1108 KB Output is correct
15 Correct 91 ms 1108 KB Output is correct
16 Correct 69 ms 1256 KB Output is correct
17 Correct 75 ms 1136 KB Output is correct
18 Correct 40 ms 1104 KB Output is correct
19 Execution timed out 4017 ms 496 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 157 ms 1084 KB Output is correct
3 Correct 84 ms 1236 KB Output is correct
4 Correct 76 ms 1104 KB Output is correct
5 Correct 71 ms 1108 KB Output is correct
6 Correct 55 ms 1300 KB Output is correct
7 Correct 88 ms 1124 KB Output is correct
8 Correct 70 ms 1272 KB Output is correct
9 Correct 75 ms 1196 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 155 ms 1280 KB Output is correct
12 Correct 89 ms 1420 KB Output is correct
13 Correct 51 ms 1108 KB Output is correct
14 Correct 54 ms 1108 KB Output is correct
15 Correct 54 ms 1132 KB Output is correct
16 Correct 89 ms 1104 KB Output is correct
17 Correct 64 ms 1244 KB Output is correct
18 Correct 40 ms 1116 KB Output is correct
19 Correct 2325 ms 3316 KB Output is correct
20 Correct 885 ms 3392 KB Output is correct
21 Correct 116 ms 3228 KB Output is correct
22 Correct 70 ms 3284 KB Output is correct
23 Correct 76 ms 3292 KB Output is correct
24 Correct 73 ms 3424 KB Output is correct
25 Correct 80 ms 3252 KB Output is correct
26 Correct 128 ms 3436 KB Output is correct
27 Correct 75 ms 3412 KB Output is correct
28 Runtime error 453 ms 1048576 KB Execution killed with signal 9
29 Halted 0 ms 0 KB -