답안 #1041823

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041823 2024-08-02T08:32:29 Z 정민찬(#11002) Bring Down the Grading Server (CEOI23_gradingserver) C++17
5 / 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) {
    if (c1 == 0) return false;
    if (c2 == 0) return true;
    if (f2 && c1 >= f2*S && c2 <= f1*S) return true;
    if (dp.find({c1,f1,c2,f2}) != dp.end()) return dp[{c1,f1,c2,f2}];
    if (c2 + f2*S <= c1) 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);
        }
        else {
            return !go(c2, f2-cnt2-1, c1, f1-cnt2);
        }
    }
    if (f2) {
        if (!go(c2, f2-1, c1, f1))
            return dp[{c1,f1,c2,f2}] = 1;
    }
    if (f2*S < c1) {
        if (!go(c2-(c1-f2*S), f2, c1, f1))
            return dp[{c1,f1,c2,f2}] = 1; 
    }
    return dp[{c1,f1,c2,f2}] = 0;
}

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)) {
            cout << "YES\n";
        }
        else cout << "NO\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 501 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 1765 ms 129876 KB Output is correct
3 Correct 214 ms 16208 KB Output is correct
4 Correct 150 ms 11828 KB Output is correct
5 Correct 292 ms 21196 KB Output is correct
6 Correct 145 ms 7504 KB Output is correct
7 Correct 197 ms 8256 KB Output is correct
8 Correct 229 ms 11736 KB Output is correct
9 Correct 852 ms 61312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1765 ms 129876 KB Output is correct
3 Correct 214 ms 16208 KB Output is correct
4 Correct 150 ms 11828 KB Output is correct
5 Correct 292 ms 21196 KB Output is correct
6 Correct 145 ms 7504 KB Output is correct
7 Correct 197 ms 8256 KB Output is correct
8 Correct 229 ms 11736 KB Output is correct
9 Correct 852 ms 61312 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 2048 ms 129884 KB Output is correct
12 Correct 211 ms 16060 KB Output is correct
13 Correct 143 ms 11560 KB Output is correct
14 Correct 339 ms 21368 KB Output is correct
15 Correct 149 ms 7380 KB Output is correct
16 Correct 160 ms 7960 KB Output is correct
17 Correct 192 ms 11604 KB Output is correct
18 Correct 674 ms 61188 KB Output is correct
19 Execution timed out 4057 ms 341844 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 426 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 1765 ms 129876 KB Output is correct
3 Correct 214 ms 16208 KB Output is correct
4 Correct 150 ms 11828 KB Output is correct
5 Correct 292 ms 21196 KB Output is correct
6 Correct 145 ms 7504 KB Output is correct
7 Correct 197 ms 8256 KB Output is correct
8 Correct 229 ms 11736 KB Output is correct
9 Correct 852 ms 61312 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 2048 ms 129884 KB Output is correct
12 Correct 211 ms 16060 KB Output is correct
13 Correct 143 ms 11560 KB Output is correct
14 Correct 339 ms 21368 KB Output is correct
15 Correct 149 ms 7380 KB Output is correct
16 Correct 160 ms 7960 KB Output is correct
17 Correct 192 ms 11604 KB Output is correct
18 Correct 674 ms 61188 KB Output is correct
19 Execution timed out 4057 ms 341844 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1765 ms 129876 KB Output is correct
3 Correct 214 ms 16208 KB Output is correct
4 Correct 150 ms 11828 KB Output is correct
5 Correct 292 ms 21196 KB Output is correct
6 Correct 145 ms 7504 KB Output is correct
7 Correct 197 ms 8256 KB Output is correct
8 Correct 229 ms 11736 KB Output is correct
9 Correct 852 ms 61312 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 2048 ms 129884 KB Output is correct
12 Correct 211 ms 16060 KB Output is correct
13 Correct 143 ms 11560 KB Output is correct
14 Correct 339 ms 21368 KB Output is correct
15 Correct 149 ms 7380 KB Output is correct
16 Correct 160 ms 7960 KB Output is correct
17 Correct 192 ms 11604 KB Output is correct
18 Correct 674 ms 61188 KB Output is correct
19 Execution timed out 4057 ms 341844 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1765 ms 129876 KB Output is correct
3 Correct 214 ms 16208 KB Output is correct
4 Correct 150 ms 11828 KB Output is correct
5 Correct 292 ms 21196 KB Output is correct
6 Correct 145 ms 7504 KB Output is correct
7 Correct 197 ms 8256 KB Output is correct
8 Correct 229 ms 11736 KB Output is correct
9 Correct 852 ms 61312 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1673 ms 128432 KB Output is correct
12 Correct 182 ms 14580 KB Output is correct
13 Correct 161 ms 9812 KB Output is correct
14 Correct 261 ms 19540 KB Output is correct
15 Correct 137 ms 5824 KB Output is correct
16 Correct 142 ms 6492 KB Output is correct
17 Correct 173 ms 10092 KB Output is correct
18 Correct 650 ms 59672 KB Output is correct
19 Execution timed out 4074 ms 347924 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1765 ms 129876 KB Output is correct
3 Correct 214 ms 16208 KB Output is correct
4 Correct 150 ms 11828 KB Output is correct
5 Correct 292 ms 21196 KB Output is correct
6 Correct 145 ms 7504 KB Output is correct
7 Correct 197 ms 8256 KB Output is correct
8 Correct 229 ms 11736 KB Output is correct
9 Correct 852 ms 61312 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 2048 ms 129884 KB Output is correct
12 Correct 211 ms 16060 KB Output is correct
13 Correct 143 ms 11560 KB Output is correct
14 Correct 339 ms 21368 KB Output is correct
15 Correct 149 ms 7380 KB Output is correct
16 Correct 160 ms 7960 KB Output is correct
17 Correct 192 ms 11604 KB Output is correct
18 Correct 674 ms 61188 KB Output is correct
19 Execution timed out 4057 ms 341844 KB Time limit exceeded
20 Halted 0 ms 0 KB -