답안 #1041816

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

using namespace std;
typedef long long ll;

ll S, Q;
ll dp[80][80][80][80];

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[c1][f1][c2][f2] != -1) 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;
    memset(dp, -1, sizeof(dp));
    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";
    }
}

Compilation message

gradingserver.cpp: In function 'bool go(ll, ll, ll, ll)':
gradingserver.cpp:27:39: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   27 |             return dp[c1][f1][c2][f2] = 1;
      |                    ~~~~~~~~~~~~~~~~~~~^~~
gradingserver.cpp:31:39: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   31 |             return dp[c1][f1][c2][f2] = 1;
      |                    ~~~~~~~~~~~~~~~~~~~^~~
gradingserver.cpp:33:31: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   33 |     return dp[c1][f1][c2][f2] = 0;
      |            ~~~~~~~~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 320848 KB Output is correct
2 Correct 88 ms 321104 KB Output is correct
3 Runtime error 284 ms 650676 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 95 ms 320860 KB Output is correct
2 Correct 218 ms 322168 KB Output is correct
3 Correct 157 ms 321876 KB Output is correct
4 Correct 164 ms 321856 KB Output is correct
5 Correct 174 ms 321872 KB Output is correct
6 Correct 160 ms 321692 KB Output is correct
7 Correct 178 ms 321876 KB Output is correct
8 Correct 190 ms 321876 KB Output is correct
9 Correct 179 ms 321876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 95 ms 320860 KB Output is correct
2 Correct 218 ms 322168 KB Output is correct
3 Correct 157 ms 321876 KB Output is correct
4 Correct 164 ms 321856 KB Output is correct
5 Correct 174 ms 321872 KB Output is correct
6 Correct 160 ms 321692 KB Output is correct
7 Correct 178 ms 321876 KB Output is correct
8 Correct 190 ms 321876 KB Output is correct
9 Correct 179 ms 321876 KB Output is correct
10 Correct 96 ms 321040 KB Output is correct
11 Correct 197 ms 321804 KB Output is correct
12 Correct 153 ms 321876 KB Output is correct
13 Correct 170 ms 321912 KB Output is correct
14 Correct 167 ms 321744 KB Output is correct
15 Correct 177 ms 321832 KB Output is correct
16 Correct 156 ms 321876 KB Output is correct
17 Correct 191 ms 321880 KB Output is correct
18 Correct 161 ms 321872 KB Output is correct
19 Runtime error 362 ms 650544 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 314 ms 650468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 95 ms 320860 KB Output is correct
2 Correct 218 ms 322168 KB Output is correct
3 Correct 157 ms 321876 KB Output is correct
4 Correct 164 ms 321856 KB Output is correct
5 Correct 174 ms 321872 KB Output is correct
6 Correct 160 ms 321692 KB Output is correct
7 Correct 178 ms 321876 KB Output is correct
8 Correct 190 ms 321876 KB Output is correct
9 Correct 179 ms 321876 KB Output is correct
10 Correct 96 ms 321040 KB Output is correct
11 Correct 197 ms 321804 KB Output is correct
12 Correct 153 ms 321876 KB Output is correct
13 Correct 170 ms 321912 KB Output is correct
14 Correct 167 ms 321744 KB Output is correct
15 Correct 177 ms 321832 KB Output is correct
16 Correct 156 ms 321876 KB Output is correct
17 Correct 191 ms 321880 KB Output is correct
18 Correct 161 ms 321872 KB Output is correct
19 Runtime error 362 ms 650544 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 95 ms 320860 KB Output is correct
2 Correct 218 ms 322168 KB Output is correct
3 Correct 157 ms 321876 KB Output is correct
4 Correct 164 ms 321856 KB Output is correct
5 Correct 174 ms 321872 KB Output is correct
6 Correct 160 ms 321692 KB Output is correct
7 Correct 178 ms 321876 KB Output is correct
8 Correct 190 ms 321876 KB Output is correct
9 Correct 179 ms 321876 KB Output is correct
10 Correct 96 ms 321040 KB Output is correct
11 Correct 197 ms 321804 KB Output is correct
12 Correct 153 ms 321876 KB Output is correct
13 Correct 170 ms 321912 KB Output is correct
14 Correct 167 ms 321744 KB Output is correct
15 Correct 177 ms 321832 KB Output is correct
16 Correct 156 ms 321876 KB Output is correct
17 Correct 191 ms 321880 KB Output is correct
18 Correct 161 ms 321872 KB Output is correct
19 Runtime error 362 ms 650544 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 95 ms 320860 KB Output is correct
2 Correct 218 ms 322168 KB Output is correct
3 Correct 157 ms 321876 KB Output is correct
4 Correct 164 ms 321856 KB Output is correct
5 Correct 174 ms 321872 KB Output is correct
6 Correct 160 ms 321692 KB Output is correct
7 Correct 178 ms 321876 KB Output is correct
8 Correct 190 ms 321876 KB Output is correct
9 Correct 179 ms 321876 KB Output is correct
10 Correct 93 ms 320852 KB Output is correct
11 Correct 187 ms 321920 KB Output is correct
12 Correct 196 ms 321936 KB Output is correct
13 Correct 193 ms 321908 KB Output is correct
14 Correct 192 ms 321872 KB Output is correct
15 Correct 159 ms 321768 KB Output is correct
16 Correct 192 ms 321872 KB Output is correct
17 Correct 146 ms 321876 KB Output is correct
18 Correct 176 ms 321872 KB Output is correct
19 Runtime error 364 ms 650592 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 95 ms 320860 KB Output is correct
2 Correct 218 ms 322168 KB Output is correct
3 Correct 157 ms 321876 KB Output is correct
4 Correct 164 ms 321856 KB Output is correct
5 Correct 174 ms 321872 KB Output is correct
6 Correct 160 ms 321692 KB Output is correct
7 Correct 178 ms 321876 KB Output is correct
8 Correct 190 ms 321876 KB Output is correct
9 Correct 179 ms 321876 KB Output is correct
10 Correct 96 ms 321040 KB Output is correct
11 Correct 197 ms 321804 KB Output is correct
12 Correct 153 ms 321876 KB Output is correct
13 Correct 170 ms 321912 KB Output is correct
14 Correct 167 ms 321744 KB Output is correct
15 Correct 177 ms 321832 KB Output is correct
16 Correct 156 ms 321876 KB Output is correct
17 Correct 191 ms 321880 KB Output is correct
18 Correct 161 ms 321872 KB Output is correct
19 Runtime error 362 ms 650544 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -