Submission #1036712

# Submission time Handle Problem Language Result Execution time Memory
1036712 2024-07-27T15:52:36 Z model_code Bring Down the Grading Server (CEOI23_gradingserver) C++17
100 / 100
303 ms 5616 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr ll inf = 1e18;

ll S, bound;

struct State{
    ll a1, d1, a2, d2;
    bool operator==(const State& other) const {return a1==other.a1 && a2 == other.a2 && d1 == other.d1 && d2 == other.d2;}
};

State sab(State state){
    return {state.a2, max(0ll, state.d2 - 1), state.a1, state.d1};
}
State att(State state){
    return {state.a2 - (state.a1 - S*state.d2), state.d2, state.a1, state.d1};
}

bool half_sab_win(State state){
    ll sab_cnt = state.d2 / 2;
    state.a1 -= sab_cnt * (state.a2 - S*state.d1);
    state.d2 -= sab_cnt;
    state = att(state);
    state.a1 -= state.d2 * (state.a2 - S*state.d1);
    state.d2 = 0;
    state = att(state);

    ll alpha1 = state.a1 - S*state.d2;
    ll beta2 = S - state.a2;
    return alpha1 + state.d2 * beta2 >= S;
}

void dbg(State state){
    cerr << state.a1 << " " << state.d1 << " " << state.a2 << " " << state.d2 << endl;
}

int calls = 0;
vector<vector<ll>> critA2;
vector<vector<vector<int>>> lookup; // (d1, d2, alpha2 - minAlpha2) -> d2' until which we sabotage
vector<ll> zeroLookup; // a2 -> min winning a1 (if d1 = d2 = 0)
bool afterPrecalc = false;

ll minAlpha2(ll d1, ll d2){
    return S - min(S, 8*S/(d2*d2*max(1ll, d1)));
}

bool wins(State state){
    if(afterPrecalc) calls++;
    // trivial cases
    if(state.a1 <= 0) return false;
    if(state.a2 <= 0) return true;

    if(state.d1 == 0 && state.d2 == 0 && state.a2 < S){
        return state.a1 >= zeroLookup[state.a2];
    }

    // no one can attack
    ll sab_rounds = (max(0ll, min(state.d2*S - state.a1, state.d1*S - state.a2)) + S-1) / S;
    state.d1 -= sab_rounds;
    state.d2 -= sab_rounds;
    // player 1 can't attack and player 2 can't sabotage
    if(state.a1 <= state.d2*S && state.d1 == 0 && state.a2 < S){
        ll beta2 = S - state.a2;
        ll rounds = (state.d2*S - state.a1 + beta2-1) / beta2;
        state.d2 -= rounds;
        state.a1 -= rounds * state.a2;
        if(state.d2 < 0 || state.a1 <= 0) return false;
    }
    // player 1 can't attack
    if(state.a1 <= state.d2*S) return !wins(sab(state));
    // helpful values
    ll alpha1 = state.a1 - S*state.d2;
    ll alpha2 = state.a2 - S*state.d1;
    ll beta2 = min(S, S - alpha2); // The inequalities work without min, but it's needed to prevent overflow!
    // player 1 must attack
    if(alpha1 >= S && alpha2 <= S) return true;
    if(alpha2 >= S) return !wins(att(state));
    if(state.d2 == 0) return !wins(att(state));
    // Can player 1 win by repeated sabotage?
    if(state.d2 >= S) return true; // prevent overflow!
    if(alpha1 + state.d2 * beta2 >= S) return true;
    // Prevent opponent win by repeated sabotage:
    if(state.d1 > 0){
        // (alpha2 - alpha1) + d1 * (S - alpha1) < S
        // S * (d1 - 1) + alpha2 < alpha1 * (d1 + 1)
        ll minAlpha1 = (S * (state.d1 - 1) + alpha2) / (state.d1 + 1);
        ll sabs_todo = min(state.d2, (max(0ll, minAlpha1 - alpha1) + beta2-1) / beta2);
        state.d2 -= sabs_todo;
        state.a1 -= sabs_todo * alpha2;
    }
    alpha2 = state.a2 - S*state.d1;
    // Can player 1 win by using half of his sabotages?
    if(half_sab_win(state)) return true;
    assert(state.d1 * state.d2 * state.d2 * (S - alpha2) <= 8*S);
    if(state.d1 * state.d2 > bound){
        dbg(state);
    }
    assert(state.d1 * state.d2 <= bound);

    if(state.d2 == 0) return !wins(att(state));
    ll crit = critA2[state.d1][state.d2];
    if(alpha2 >= crit) return !wins(att(state));
    if(state.d2 == 1) return !wins(sab(state)); // alpha2 < crit
    // now we can use the lookup table
    int sabs_todo = (int)state.d2 - lookup[state.d1][state.d2][alpha2 - minAlpha2(state.d1, state.d2)];
    if(sabs_todo > state.d2){
        dbg(state);
        exit(0);
    }
    state.d2 -= sabs_todo;
    state.a1 -= sabs_todo * alpha2;
    assert(state.d2 >= 0);
    // maybe we reached d2 == 1
    if(state.d2 == 1){
        if(alpha2 >= critA2[state.d1][state.d2]) return !wins(att(state));
        else return !wins(sab(state));
    }
    return !wins(att(state));
}

// It can be proven that we need O(1) iterations when min(d1, d2) > 1
bool winsSafe(State state){
    if(state.a1 <= state.d2*S) return !wins(sab(state));
    if(state.d2 == 0) return !winsSafe(att(state));
    return !wins(sab(state)) || !winsSafe(att(state));
}

// minimum alpha1 for which player1 wins if he sabotages
ll sabCrit(ll d1, ll d2, ll alpha2){
    ll lo = 0, hi = S;
    for(ll alpha1 = (lo + hi)/2; lo<hi; alpha1 = (lo + hi)/2){
        if(!wins(sab({d2*S+alpha1, d1, d1*S+alpha2, d2}))) hi = alpha1;
        else lo = alpha1+1;
    }
    return lo;
}

// minimum alpha1 for which player1 wins if he attacks
ll attCrit(ll d1, ll d2, ll alpha2){
    ll lo = 0, hi = S;
    for(ll alpha1 = (lo + hi)/2; lo<hi; alpha1 = (lo + hi)/2){
        if(!winsSafe(att({d2*S+alpha1, d1, d1*S+alpha2, d2}))) hi = alpha1;
        else lo = alpha1+1;
    }
    return lo;
}

// minimum alpha2 for which it is optimal for player 1 to attack
ll calcCritA2(ll d1, ll d2){
    ll lo = S - S/d2, hi = S;
    for(ll alpha2 = (lo+hi)/2; lo<hi; alpha2 = (lo+hi)/2){
        ll sc = sabCrit(d1, d2, alpha2);
        ll ac = attCrit(d1, d2, alpha2);
        if(sc < ac || (sc == 0 && ac == 0)) lo = alpha2+1;
        else hi = alpha2;
    }
    return lo;
}

ll wins2(State state){
    // trivial cases
    if(state.a1 <= 0) return false;
    if(state.a2 <= 0) return true;
    // no one can attack
    ll sab_rounds = (max(0ll, min(state.d2*S - state.a1, state.d1*S - state.a2)) + S-1) / S;
    state.d1 -= sab_rounds;
    state.d2 -= sab_rounds;
    // player 1 can't attack and player 2 can't sabotage
    if(state.a1 <= state.d2*S && state.d1 == 0 && state.a2 < S){
        ll beta2 = S - state.a2;
        ll rounds = (state.d2*S - state.a1 + beta2-1) / beta2;
        state.d2 -= rounds;
        state.a1 -= rounds * state.a2;
        if(state.d2 < 0 || state.a1 <= 0) return false;
    }
    // player 1 can't attack
    if(state.a1 <= state.d2*S) return !wins2(sab(state));
    // helpful values
    ll alpha1 = state.a1 - S*state.d2;
    ll alpha2 = state.a2 - S*state.d1;
    ll beta2 = min(S, S - alpha2);
    // player 1 must attack
    if(alpha1 >= S && alpha2 <= S) return true;
    if(alpha2 >= S) return !wins2(att(state));
    if(state.d2 == 0) return !wins2(att(state));
    // Can player 1 win by repeated sabotage?
    if(state.d2 >= S) return true; // prevent overflow!
    if(alpha1 + state.d2 * beta2 >= S) return true;
    // Prevent opponent win by repeated sabotage:
    if(state.d1 > 0){
        // (alpha2 - alpha1) + d1 * (S - alpha1) < S
        // S * (d1 - 1) + alpha2 < alpha1 * (d1 + 1)
        ll minAlpha1 = (S * (state.d1 - 1) + alpha2) / (state.d1 + 1);
        ll sabs_todo = min(state.d2, (max(0ll, minAlpha1 - alpha1) + beta2-1) / beta2);
        state.d2 -= sabs_todo;
        state.a1 -= sabs_todo * alpha2;
    }
    // Can player 1 win by using half of his sabotages?
    if(half_sab_win(state)) return true;


    while(state.d2 > 0){
        if(state.d1 * state.d2 <= bound) return wins(state);
        if(!wins(att(state))) return true;
        state = att(sab(state));
    }
    return !wins(att(state));
}

bool win0(ll a1, ll a2){
    if(a1 <= 0) return false;
    if(a2 <= 0) return true;
    return !win0(a2-a1, a1);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int Q;
    cin >> S >> Q;
    zeroLookup.resize(S);
    {
        ll a1 = 1;
        for(ll a2 = 1; a2 < S; a2++){
            while(a1 < S && !win0(a1, a2)) a1++;
            zeroLookup[a2] = a1;
        }
    }

    bound = 1; while(bound*bound <= 8*S) bound++;
    critA2.assign(bound+1, vector<ll>(1, -1));
    lookup.assign(bound+1, vector<vector<int>>(2));
    vector<pair<ll, ll>> dvals;
    for(ll d2 = 1; d2 <= bound; d2++){
        for(ll d1 = 0; d1*d2 <= bound; d1++){
            dvals.emplace_back(d1, d2);
            critA2[d1].push_back(inf);
            if(d2 > 1){
                lookup[d1].push_back(vector<int>(S - minAlpha2(d1, d2), -1));
            }
        }
    }
    sort(dvals.begin(), dvals.end(), [](auto a, auto b){return a.first+a.second < b.first+b.second;});
    for(auto [d1, d2] : dvals){
        critA2[d1][d2] = calcCritA2(d1, d2);
        if(d2 == 1) continue;
        ll mi = minAlpha2(d1, d2);
        for(ll alpha2 = max(mi, critA2[d1][d2]); alpha2 < S; alpha2++){
            lookup[d1][d2][alpha2-mi] = (int)d2;
        }
        if(d2 == 2){
            for(ll alpha2 = mi; alpha2 < critA2[d1][d2]; alpha2++){
                lookup[d1][d2][alpha2-mi] = 1;
            }
        }
        else{
            ll oldMi = minAlpha2(d1, d2-1);
            for(ll alpha2 = mi; alpha2 < critA2[d1][d2]; alpha2++){
                lookup[d1][d2][alpha2-mi] = lookup[d1][d2-1][alpha2-oldMi];
            }
        }
    }
    afterPrecalc = true;

    cerr << dvals.size() << "\n";

    for(int q = 0; q < Q; q++){
        ll a1, d1, a2, d2;
        cin >> a1 >> d1 >> a2 >> d2;
        cout << (wins2({a1, d1, a2, d2}) ? "YES" : "NO") << "\n";
    }

    cerr << calls << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 53 ms 1268 KB Output is correct
3 Correct 51 ms 1324 KB Output is correct
4 Correct 59 ms 1120 KB Output is correct
5 Correct 50 ms 1112 KB Output is correct
6 Correct 52 ms 1108 KB Output is correct
7 Correct 55 ms 1108 KB Output is correct
8 Correct 55 ms 1296 KB Output is correct
9 Correct 51 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 53 ms 1268 KB Output is correct
3 Correct 51 ms 1324 KB Output is correct
4 Correct 59 ms 1120 KB Output is correct
5 Correct 50 ms 1112 KB Output is correct
6 Correct 52 ms 1108 KB Output is correct
7 Correct 55 ms 1108 KB Output is correct
8 Correct 55 ms 1296 KB Output is correct
9 Correct 51 ms 1104 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 53 ms 1256 KB Output is correct
12 Correct 51 ms 1116 KB Output is correct
13 Correct 54 ms 1096 KB Output is correct
14 Correct 49 ms 1232 KB Output is correct
15 Correct 54 ms 1128 KB Output is correct
16 Correct 64 ms 1292 KB Output is correct
17 Correct 52 ms 1184 KB Output is correct
18 Correct 78 ms 1104 KB Output is correct
19 Correct 70 ms 1076 KB Output is correct
20 Correct 58 ms 1108 KB Output is correct
21 Correct 63 ms 1300 KB Output is correct
22 Correct 60 ms 1132 KB Output is correct
23 Correct 57 ms 1328 KB Output is correct
24 Correct 56 ms 1244 KB Output is correct
25 Correct 56 ms 1228 KB Output is correct
26 Correct 50 ms 1204 KB Output is correct
27 Correct 53 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 95 ms 1104 KB Output is correct
2 Correct 99 ms 1216 KB Output is correct
3 Correct 91 ms 1092 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 53 ms 1268 KB Output is correct
3 Correct 51 ms 1324 KB Output is correct
4 Correct 59 ms 1120 KB Output is correct
5 Correct 50 ms 1112 KB Output is correct
6 Correct 52 ms 1108 KB Output is correct
7 Correct 55 ms 1108 KB Output is correct
8 Correct 55 ms 1296 KB Output is correct
9 Correct 51 ms 1104 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 53 ms 1256 KB Output is correct
12 Correct 51 ms 1116 KB Output is correct
13 Correct 54 ms 1096 KB Output is correct
14 Correct 49 ms 1232 KB Output is correct
15 Correct 54 ms 1128 KB Output is correct
16 Correct 64 ms 1292 KB Output is correct
17 Correct 52 ms 1184 KB Output is correct
18 Correct 78 ms 1104 KB Output is correct
19 Correct 70 ms 1076 KB Output is correct
20 Correct 58 ms 1108 KB Output is correct
21 Correct 63 ms 1300 KB Output is correct
22 Correct 60 ms 1132 KB Output is correct
23 Correct 57 ms 1328 KB Output is correct
24 Correct 56 ms 1244 KB Output is correct
25 Correct 56 ms 1228 KB Output is correct
26 Correct 50 ms 1204 KB Output is correct
27 Correct 53 ms 1152 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 53 ms 1316 KB Output is correct
30 Correct 50 ms 1296 KB Output is correct
31 Correct 89 ms 1104 KB Output is correct
32 Correct 49 ms 1108 KB Output is correct
33 Correct 51 ms 1292 KB Output is correct
34 Correct 51 ms 1188 KB Output is correct
35 Correct 75 ms 1268 KB Output is correct
36 Correct 89 ms 1104 KB Output is correct
37 Correct 55 ms 1312 KB Output is correct
38 Correct 89 ms 1300 KB Output is correct
39 Correct 66 ms 1364 KB Output is correct
40 Correct 56 ms 1368 KB Output is correct
41 Correct 55 ms 1340 KB Output is correct
42 Correct 55 ms 1272 KB Output is correct
43 Correct 79 ms 1212 KB Output is correct
44 Correct 51 ms 1320 KB Output is correct
45 Correct 55 ms 1128 KB Output is correct
46 Correct 93 ms 1364 KB Output is correct
47 Correct 101 ms 1100 KB Output is correct
48 Correct 75 ms 1308 KB Output is correct
49 Correct 70 ms 1364 KB Output is correct
50 Correct 66 ms 1372 KB Output is correct
51 Correct 101 ms 1360 KB Output is correct
52 Correct 61 ms 1364 KB Output is correct
53 Correct 49 ms 1372 KB Output is correct
54 Correct 52 ms 1288 KB Output is correct
55 Correct 78 ms 1136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 53 ms 1268 KB Output is correct
3 Correct 51 ms 1324 KB Output is correct
4 Correct 59 ms 1120 KB Output is correct
5 Correct 50 ms 1112 KB Output is correct
6 Correct 52 ms 1108 KB Output is correct
7 Correct 55 ms 1108 KB Output is correct
8 Correct 55 ms 1296 KB Output is correct
9 Correct 51 ms 1104 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 53 ms 1256 KB Output is correct
12 Correct 51 ms 1116 KB Output is correct
13 Correct 54 ms 1096 KB Output is correct
14 Correct 49 ms 1232 KB Output is correct
15 Correct 54 ms 1128 KB Output is correct
16 Correct 64 ms 1292 KB Output is correct
17 Correct 52 ms 1184 KB Output is correct
18 Correct 78 ms 1104 KB Output is correct
19 Correct 70 ms 1076 KB Output is correct
20 Correct 58 ms 1108 KB Output is correct
21 Correct 63 ms 1300 KB Output is correct
22 Correct 60 ms 1132 KB Output is correct
23 Correct 57 ms 1328 KB Output is correct
24 Correct 56 ms 1244 KB Output is correct
25 Correct 56 ms 1228 KB Output is correct
26 Correct 50 ms 1204 KB Output is correct
27 Correct 53 ms 1152 KB Output is correct
28 Correct 95 ms 1104 KB Output is correct
29 Correct 99 ms 1216 KB Output is correct
30 Correct 91 ms 1092 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 120 ms 1216 KB Output is correct
33 Correct 116 ms 1108 KB Output is correct
34 Correct 89 ms 1300 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 57 ms 1240 KB Output is correct
38 Correct 60 ms 1264 KB Output is correct
39 Correct 52 ms 1148 KB Output is correct
40 Correct 49 ms 1116 KB Output is correct
41 Correct 81 ms 1148 KB Output is correct
42 Correct 51 ms 1304 KB Output is correct
43 Correct 50 ms 1248 KB Output is correct
44 Correct 48 ms 1108 KB Output is correct
45 Correct 63 ms 1272 KB Output is correct
46 Correct 55 ms 1120 KB Output is correct
47 Correct 98 ms 1192 KB Output is correct
48 Correct 58 ms 1284 KB Output is correct
49 Correct 56 ms 1252 KB Output is correct
50 Correct 56 ms 1364 KB Output is correct
51 Correct 60 ms 1308 KB Output is correct
52 Correct 51 ms 1140 KB Output is correct
53 Correct 57 ms 1252 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 57 ms 1300 KB Output is correct
56 Correct 57 ms 1364 KB Output is correct
57 Correct 69 ms 1364 KB Output is correct
58 Correct 61 ms 1104 KB Output is correct
59 Correct 74 ms 1104 KB Output is correct
60 Correct 88 ms 1360 KB Output is correct
61 Correct 90 ms 1308 KB Output is correct
62 Correct 94 ms 1300 KB Output is correct
63 Correct 95 ms 1216 KB Output is correct
64 Correct 90 ms 1268 KB Output is correct
65 Correct 108 ms 1364 KB Output is correct
66 Correct 64 ms 1360 KB Output is correct
67 Correct 62 ms 1364 KB Output is correct
68 Correct 86 ms 1104 KB Output is correct
69 Correct 108 ms 1308 KB Output is correct
70 Correct 112 ms 1364 KB Output is correct
71 Correct 184 ms 1288 KB Output is correct
72 Correct 118 ms 1216 KB Output is correct
73 Correct 101 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 53 ms 1268 KB Output is correct
3 Correct 51 ms 1324 KB Output is correct
4 Correct 59 ms 1120 KB Output is correct
5 Correct 50 ms 1112 KB Output is correct
6 Correct 52 ms 1108 KB Output is correct
7 Correct 55 ms 1108 KB Output is correct
8 Correct 55 ms 1296 KB Output is correct
9 Correct 51 ms 1104 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 65 ms 1072 KB Output is correct
12 Correct 50 ms 1116 KB Output is correct
13 Correct 55 ms 1108 KB Output is correct
14 Correct 53 ms 1316 KB Output is correct
15 Correct 52 ms 1300 KB Output is correct
16 Correct 52 ms 1160 KB Output is correct
17 Correct 50 ms 1220 KB Output is correct
18 Correct 48 ms 1108 KB Output is correct
19 Correct 79 ms 1120 KB Output is correct
20 Correct 148 ms 1872 KB Output is correct
21 Correct 192 ms 4560 KB Output is correct
22 Correct 222 ms 5356 KB Output is correct
23 Correct 230 ms 4696 KB Output is correct
24 Correct 254 ms 5356 KB Output is correct
25 Correct 166 ms 1864 KB Output is correct
26 Correct 136 ms 1252 KB Output is correct
27 Correct 285 ms 5460 KB Output is correct
28 Correct 303 ms 5368 KB Output is correct
29 Correct 210 ms 5248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 53 ms 1268 KB Output is correct
3 Correct 51 ms 1324 KB Output is correct
4 Correct 59 ms 1120 KB Output is correct
5 Correct 50 ms 1112 KB Output is correct
6 Correct 52 ms 1108 KB Output is correct
7 Correct 55 ms 1108 KB Output is correct
8 Correct 55 ms 1296 KB Output is correct
9 Correct 51 ms 1104 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 53 ms 1256 KB Output is correct
12 Correct 51 ms 1116 KB Output is correct
13 Correct 54 ms 1096 KB Output is correct
14 Correct 49 ms 1232 KB Output is correct
15 Correct 54 ms 1128 KB Output is correct
16 Correct 64 ms 1292 KB Output is correct
17 Correct 52 ms 1184 KB Output is correct
18 Correct 78 ms 1104 KB Output is correct
19 Correct 70 ms 1076 KB Output is correct
20 Correct 58 ms 1108 KB Output is correct
21 Correct 63 ms 1300 KB Output is correct
22 Correct 60 ms 1132 KB Output is correct
23 Correct 57 ms 1328 KB Output is correct
24 Correct 56 ms 1244 KB Output is correct
25 Correct 56 ms 1228 KB Output is correct
26 Correct 50 ms 1204 KB Output is correct
27 Correct 53 ms 1152 KB Output is correct
28 Correct 95 ms 1104 KB Output is correct
29 Correct 99 ms 1216 KB Output is correct
30 Correct 91 ms 1092 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 53 ms 1316 KB Output is correct
34 Correct 50 ms 1296 KB Output is correct
35 Correct 89 ms 1104 KB Output is correct
36 Correct 49 ms 1108 KB Output is correct
37 Correct 51 ms 1292 KB Output is correct
38 Correct 51 ms 1188 KB Output is correct
39 Correct 75 ms 1268 KB Output is correct
40 Correct 89 ms 1104 KB Output is correct
41 Correct 55 ms 1312 KB Output is correct
42 Correct 89 ms 1300 KB Output is correct
43 Correct 66 ms 1364 KB Output is correct
44 Correct 56 ms 1368 KB Output is correct
45 Correct 55 ms 1340 KB Output is correct
46 Correct 55 ms 1272 KB Output is correct
47 Correct 79 ms 1212 KB Output is correct
48 Correct 51 ms 1320 KB Output is correct
49 Correct 55 ms 1128 KB Output is correct
50 Correct 93 ms 1364 KB Output is correct
51 Correct 101 ms 1100 KB Output is correct
52 Correct 75 ms 1308 KB Output is correct
53 Correct 70 ms 1364 KB Output is correct
54 Correct 66 ms 1372 KB Output is correct
55 Correct 101 ms 1360 KB Output is correct
56 Correct 61 ms 1364 KB Output is correct
57 Correct 49 ms 1372 KB Output is correct
58 Correct 52 ms 1288 KB Output is correct
59 Correct 78 ms 1136 KB Output is correct
60 Correct 120 ms 1216 KB Output is correct
61 Correct 116 ms 1108 KB Output is correct
62 Correct 89 ms 1300 KB Output is correct
63 Correct 0 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 57 ms 1240 KB Output is correct
66 Correct 60 ms 1264 KB Output is correct
67 Correct 52 ms 1148 KB Output is correct
68 Correct 49 ms 1116 KB Output is correct
69 Correct 81 ms 1148 KB Output is correct
70 Correct 51 ms 1304 KB Output is correct
71 Correct 50 ms 1248 KB Output is correct
72 Correct 48 ms 1108 KB Output is correct
73 Correct 63 ms 1272 KB Output is correct
74 Correct 55 ms 1120 KB Output is correct
75 Correct 98 ms 1192 KB Output is correct
76 Correct 58 ms 1284 KB Output is correct
77 Correct 56 ms 1252 KB Output is correct
78 Correct 56 ms 1364 KB Output is correct
79 Correct 60 ms 1308 KB Output is correct
80 Correct 51 ms 1140 KB Output is correct
81 Correct 57 ms 1252 KB Output is correct
82 Correct 0 ms 344 KB Output is correct
83 Correct 57 ms 1300 KB Output is correct
84 Correct 57 ms 1364 KB Output is correct
85 Correct 69 ms 1364 KB Output is correct
86 Correct 61 ms 1104 KB Output is correct
87 Correct 74 ms 1104 KB Output is correct
88 Correct 88 ms 1360 KB Output is correct
89 Correct 90 ms 1308 KB Output is correct
90 Correct 94 ms 1300 KB Output is correct
91 Correct 95 ms 1216 KB Output is correct
92 Correct 90 ms 1268 KB Output is correct
93 Correct 108 ms 1364 KB Output is correct
94 Correct 64 ms 1360 KB Output is correct
95 Correct 62 ms 1364 KB Output is correct
96 Correct 86 ms 1104 KB Output is correct
97 Correct 108 ms 1308 KB Output is correct
98 Correct 112 ms 1364 KB Output is correct
99 Correct 184 ms 1288 KB Output is correct
100 Correct 118 ms 1216 KB Output is correct
101 Correct 101 ms 1104 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 65 ms 1072 KB Output is correct
104 Correct 50 ms 1116 KB Output is correct
105 Correct 55 ms 1108 KB Output is correct
106 Correct 53 ms 1316 KB Output is correct
107 Correct 52 ms 1300 KB Output is correct
108 Correct 52 ms 1160 KB Output is correct
109 Correct 50 ms 1220 KB Output is correct
110 Correct 48 ms 1108 KB Output is correct
111 Correct 79 ms 1120 KB Output is correct
112 Correct 148 ms 1872 KB Output is correct
113 Correct 192 ms 4560 KB Output is correct
114 Correct 222 ms 5356 KB Output is correct
115 Correct 230 ms 4696 KB Output is correct
116 Correct 254 ms 5356 KB Output is correct
117 Correct 166 ms 1864 KB Output is correct
118 Correct 136 ms 1252 KB Output is correct
119 Correct 285 ms 5460 KB Output is correct
120 Correct 303 ms 5368 KB Output is correct
121 Correct 210 ms 5248 KB Output is correct
122 Correct 92 ms 1280 KB Output is correct
123 Correct 85 ms 1104 KB Output is correct
124 Correct 122 ms 1100 KB Output is correct
125 Correct 0 ms 348 KB Output is correct
126 Correct 0 ms 348 KB Output is correct
127 Correct 55 ms 1080 KB Output is correct
128 Correct 50 ms 1112 KB Output is correct
129 Correct 51 ms 1108 KB Output is correct
130 Correct 88 ms 1104 KB Output is correct
131 Correct 52 ms 1152 KB Output is correct
132 Correct 51 ms 1296 KB Output is correct
133 Correct 53 ms 1104 KB Output is correct
134 Correct 51 ms 1108 KB Output is correct
135 Correct 55 ms 1280 KB Output is correct
136 Correct 57 ms 1080 KB Output is correct
137 Correct 63 ms 1184 KB Output is correct
138 Correct 58 ms 1344 KB Output is correct
139 Correct 56 ms 1340 KB Output is correct
140 Correct 63 ms 1364 KB Output is correct
141 Correct 62 ms 1284 KB Output is correct
142 Correct 51 ms 1328 KB Output is correct
143 Correct 83 ms 1212 KB Output is correct
144 Correct 1 ms 348 KB Output is correct
145 Correct 53 ms 1384 KB Output is correct
146 Correct 87 ms 1444 KB Output is correct
147 Correct 76 ms 1252 KB Output is correct
148 Correct 59 ms 1132 KB Output is correct
149 Correct 104 ms 1108 KB Output is correct
150 Correct 90 ms 1176 KB Output is correct
151 Correct 117 ms 1388 KB Output is correct
152 Correct 131 ms 1132 KB Output is correct
153 Correct 92 ms 1108 KB Output is correct
154 Correct 87 ms 1176 KB Output is correct
155 Correct 92 ms 1108 KB Output is correct
156 Correct 76 ms 1144 KB Output is correct
157 Correct 63 ms 1392 KB Output is correct
158 Correct 89 ms 1208 KB Output is correct
159 Correct 102 ms 1260 KB Output is correct
160 Correct 113 ms 1332 KB Output is correct
161 Correct 184 ms 1212 KB Output is correct
162 Correct 95 ms 1188 KB Output is correct
163 Correct 100 ms 1212 KB Output is correct
164 Correct 70 ms 1360 KB Output is correct
165 Correct 66 ms 1448 KB Output is correct
166 Correct 75 ms 1364 KB Output is correct
167 Correct 70 ms 1364 KB Output is correct
168 Correct 81 ms 1156 KB Output is correct
169 Correct 73 ms 1348 KB Output is correct
170 Correct 147 ms 1864 KB Output is correct
171 Correct 196 ms 4560 KB Output is correct
172 Correct 231 ms 5352 KB Output is correct
173 Correct 248 ms 4648 KB Output is correct
174 Correct 253 ms 5356 KB Output is correct
175 Correct 153 ms 1876 KB Output is correct
176 Correct 129 ms 1288 KB Output is correct
177 Correct 284 ms 5356 KB Output is correct
178 Correct 285 ms 5616 KB Output is correct
179 Correct 229 ms 5204 KB Output is correct
180 Correct 100 ms 1368 KB Output is correct
181 Correct 109 ms 1924 KB Output is correct
182 Correct 163 ms 4436 KB Output is correct
183 Correct 172 ms 5360 KB Output is correct
184 Correct 130 ms 2900 KB Output is correct
185 Correct 284 ms 5352 KB Output is correct
186 Correct 254 ms 5356 KB Output is correct
187 Correct 257 ms 4564 KB Output is correct
188 Correct 232 ms 3920 KB Output is correct
189 Correct 194 ms 5200 KB Output is correct
190 Correct 233 ms 5460 KB Output is correct
191 Correct 185 ms 5208 KB Output is correct