Submission #1041813

# Submission time Handle Problem Language Result Execution time Memory
1041813 2024-08-02T08:29:17 Z 정민찬(#11002) Bring Down the Grading Server (CEOI23_gradingserver) C++17
5 / 100
323 ms 650616 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, c1, f1-cnt2-1);
        }
    }
    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;
      |            ~~~~~~~~~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 86 ms 320852 KB Output is correct
2 Correct 93 ms 321024 KB Output is correct
3 Runtime error 277 ms 650616 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 79 ms 320852 KB Output is correct
2 Correct 173 ms 321968 KB Output is correct
3 Correct 154 ms 321868 KB Output is correct
4 Correct 156 ms 321692 KB Output is correct
5 Correct 169 ms 321872 KB Output is correct
6 Correct 152 ms 321872 KB Output is correct
7 Correct 168 ms 321760 KB Output is correct
8 Correct 144 ms 321876 KB Output is correct
9 Correct 159 ms 321872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 320852 KB Output is correct
2 Correct 173 ms 321968 KB Output is correct
3 Correct 154 ms 321868 KB Output is correct
4 Correct 156 ms 321692 KB Output is correct
5 Correct 169 ms 321872 KB Output is correct
6 Correct 152 ms 321872 KB Output is correct
7 Correct 168 ms 321760 KB Output is correct
8 Correct 144 ms 321876 KB Output is correct
9 Correct 159 ms 321872 KB Output is correct
10 Correct 86 ms 320848 KB Output is correct
11 Correct 166 ms 321872 KB Output is correct
12 Correct 158 ms 321876 KB Output is correct
13 Correct 157 ms 321876 KB Output is correct
14 Correct 154 ms 321872 KB Output is correct
15 Correct 144 ms 321876 KB Output is correct
16 Correct 136 ms 321832 KB Output is correct
17 Correct 145 ms 321876 KB Output is correct
18 Correct 158 ms 321876 KB Output is correct
19 Runtime error 292 ms 650580 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 308 ms 650576 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 79 ms 320852 KB Output is correct
2 Correct 173 ms 321968 KB Output is correct
3 Correct 154 ms 321868 KB Output is correct
4 Correct 156 ms 321692 KB Output is correct
5 Correct 169 ms 321872 KB Output is correct
6 Correct 152 ms 321872 KB Output is correct
7 Correct 168 ms 321760 KB Output is correct
8 Correct 144 ms 321876 KB Output is correct
9 Correct 159 ms 321872 KB Output is correct
10 Correct 86 ms 320848 KB Output is correct
11 Correct 166 ms 321872 KB Output is correct
12 Correct 158 ms 321876 KB Output is correct
13 Correct 157 ms 321876 KB Output is correct
14 Correct 154 ms 321872 KB Output is correct
15 Correct 144 ms 321876 KB Output is correct
16 Correct 136 ms 321832 KB Output is correct
17 Correct 145 ms 321876 KB Output is correct
18 Correct 158 ms 321876 KB Output is correct
19 Runtime error 292 ms 650580 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 79 ms 320852 KB Output is correct
2 Correct 173 ms 321968 KB Output is correct
3 Correct 154 ms 321868 KB Output is correct
4 Correct 156 ms 321692 KB Output is correct
5 Correct 169 ms 321872 KB Output is correct
6 Correct 152 ms 321872 KB Output is correct
7 Correct 168 ms 321760 KB Output is correct
8 Correct 144 ms 321876 KB Output is correct
9 Correct 159 ms 321872 KB Output is correct
10 Correct 86 ms 320848 KB Output is correct
11 Correct 166 ms 321872 KB Output is correct
12 Correct 158 ms 321876 KB Output is correct
13 Correct 157 ms 321876 KB Output is correct
14 Correct 154 ms 321872 KB Output is correct
15 Correct 144 ms 321876 KB Output is correct
16 Correct 136 ms 321832 KB Output is correct
17 Correct 145 ms 321876 KB Output is correct
18 Correct 158 ms 321876 KB Output is correct
19 Runtime error 292 ms 650580 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 79 ms 320852 KB Output is correct
2 Correct 173 ms 321968 KB Output is correct
3 Correct 154 ms 321868 KB Output is correct
4 Correct 156 ms 321692 KB Output is correct
5 Correct 169 ms 321872 KB Output is correct
6 Correct 152 ms 321872 KB Output is correct
7 Correct 168 ms 321760 KB Output is correct
8 Correct 144 ms 321876 KB Output is correct
9 Correct 159 ms 321872 KB Output is correct
10 Correct 100 ms 320852 KB Output is correct
11 Correct 183 ms 321808 KB Output is correct
12 Correct 164 ms 322040 KB Output is correct
13 Correct 154 ms 321888 KB Output is correct
14 Correct 168 ms 321832 KB Output is correct
15 Correct 152 ms 321876 KB Output is correct
16 Correct 147 ms 321816 KB Output is correct
17 Correct 178 ms 321880 KB Output is correct
18 Correct 194 ms 321728 KB Output is correct
19 Runtime error 323 ms 650576 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 79 ms 320852 KB Output is correct
2 Correct 173 ms 321968 KB Output is correct
3 Correct 154 ms 321868 KB Output is correct
4 Correct 156 ms 321692 KB Output is correct
5 Correct 169 ms 321872 KB Output is correct
6 Correct 152 ms 321872 KB Output is correct
7 Correct 168 ms 321760 KB Output is correct
8 Correct 144 ms 321876 KB Output is correct
9 Correct 159 ms 321872 KB Output is correct
10 Correct 86 ms 320848 KB Output is correct
11 Correct 166 ms 321872 KB Output is correct
12 Correct 158 ms 321876 KB Output is correct
13 Correct 157 ms 321876 KB Output is correct
14 Correct 154 ms 321872 KB Output is correct
15 Correct 144 ms 321876 KB Output is correct
16 Correct 136 ms 321832 KB Output is correct
17 Correct 145 ms 321876 KB Output is correct
18 Correct 158 ms 321876 KB Output is correct
19 Runtime error 292 ms 650580 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -