Submission #860611

# Submission time Handle Problem Language Result Execution time Memory
860611 2023-10-13T14:23:13 Z E869120 Uplifting Excursion (BOI22_vault) C++14
70 / 100
5000 ms 476812 KB
#include <bits/stdc++.h>
using namespace std;

vector<long long> SolveDP(long long N, long long LIM, vector<long long> List, vector<long long> Init) {
    vector<long long> dp(LIM + 1, -(1LL << 60));
    if (Init.size() == 0) dp[0] = 0;
    else {
        for (int i = 0; i < (int)Init.size(); i++) dp[i] = Init[i];
    }

    // DP Start
    for (int i = 0; i < N; i++) {
        vector<long long> ndp(LIM + 1, -(1LL << 60));
        long long kazu = i + 1;
        for (int j = 0; j < kazu; j++) {
            vector<pair<long long, long long>> maxi;
            int cur = 0;
            for (int k = j; k <= LIM; k += kazu) {
                long long val = dp[k] - (k / kazu);
                while (maxi.size() >= cur + 1) {
                    if (maxi[maxi.size() - 1].second <= val) maxi.pop_back();
                    else break;
                }
                maxi.push_back(make_pair(1LL * k, val));
                if (maxi[cur].second >= -(1LL << 59)) ndp[k] = maxi[cur].second + (k / kazu);
                while (cur < (int)maxi.size() && maxi[cur].first <= k - 1LL * kazu * List[i]) cur += 1;
            }
        }
        dp = ndp;
    }

    // Return
    return dp;
}

void Solve_Subtask2(long long M, long long L, vector<long long> A) {
    // Step 1. Calculate
    vector<long long> A1;
    vector<long long> A2;
    for (int i = M - 1; i >= 0; i--) A1.push_back(A[i]);
    for (int i = M + 1; i <= 2 * M; i++) A2.push_back(A[i]);
    vector<long long> DP1 = SolveDP(M, 700000, A1, vector<long long>{});
    vector<long long> DP2 = SolveDP(M, 700000, A2, vector<long long>{});

    // Step 2. Output
    long long Answer = -(1LL << 60);
    for (long long i = 0; i <= 700000LL - abs(L); i++) {
        long long idx1 = i;
        long long idx2 = i + abs(L); if (L < 0) swap(idx1, idx2);
        Answer = max(Answer, DP1[idx1] + DP2[idx2]);
    }
    if (Answer < 0LL) cout << "impossible" << endl;
    else cout << Answer + A[M] << endl;
}

void Solve_Subtask3(long long M, long long L, vector<long long> A) {
    long long Baseln = (M + 1) * M * M / 2LL;
    vector<long long> L1(M + 1, 0);
    vector<long long> L2(M + 1, 0);
    vector<long long> L3(M, 0);
    vector<long long> L4(M, 0);
    vector<long long> M1(M + 1, 0);
    vector<long long> M2(M + 1, 0);
    vector<pair<long long, long long>> Cand1; Cand1.push_back(make_pair(0, 0));
    vector<pair<long long, long long>> Cand2; Cand2.push_back(make_pair(0, 0));

    // Step 1. Set Up
    for (int i = 0; i <= M - 1; i++) {
        int idx = M - i;
        long long Threshold = M;
        L1[idx - 0] = A[i] - min(A[i], Threshold);
        L3[idx - 1] = min(A[i], Threshold);
    }
    for (int i = M + 1; i <= 2 * M; i++) {
        int idx = i - M;
        long long Threshold = M;
        L2[idx - 0] = A[i] - min(A[i], Threshold);
        L4[idx - 1] = min(A[i], Threshold);
    }

    // Step 2. Base DP
    vector<long long> dp1 = SolveDP(M, Baseln, L3, vector<long long>{});
    vector<long long> dp2 = vector<long long>(Baseln + 1, -(1LL << 60));
    for (int i = 0; i <= Baseln; i++) dp2[Baseln - i] = dp1[i];
    vector<long long> dp3 = SolveDP(M, Baseln * 2, L4, dp2);

    // Step 3. Get Theoritical Value
    long long a1 = 0;
    long long a2 = 0;
    for (int i = 1; i <= M; i++) a1 += 1LL * i * L1[i];
    for (int i = 1; i <= M; i++) a2 += 1LL * i * L2[i];
    if (a2 - a1 > L) a2 = a1 + L;
    else a1 = a2 - L;
    if (a1 + Baseln < 0 || a2 + Baseln < 0) {
        cout << "impossible" << endl;
        return;
    }

    // Step 4. Get Candiates for L1
    long long rem1 = a1 + Baseln;
    long long cnt1 = 0;
    for (int i = 1; i <= M; i++) {
        M1[i] = min(L1[i], rem1 / i);
        rem1 -= 1LL * i * M1[i];
        cnt1 += M1[i];
    }
    for (int i = M; i >= 1; i--) {
        for (long long j = 0; j < M1[i]; j++) {
            Cand1.push_back(make_pair((a1 + Baseln) - rem1, cnt1));
            rem1 += 1LL * i;
            cnt1 -= 1LL;
            if (rem1 > 2LL * Baseln) break;
        }
        if (rem1 > 2LL * Baseln) break;
    }

    // Step 5. Get Candidates for L2
    long long rem2 = a2 + Baseln;
    long long cnt2 = 0;
    for (int i = 1; i <= M; i++) {
        M2[i] = min(L2[i], rem2 / i);
        rem2 -= 1LL * i * M2[i];
        cnt2 += M2[i];
    }
    for (int i = M; i >= 1; i--) {
        for (long long j = 0; j < M2[i]; j++) {
            Cand2.push_back(make_pair((a2 + Baseln) - rem2, cnt2));
            rem2 += 1LL * i;
            cnt2 -= 1LL;
            if (rem2 > 2LL * Baseln) break;
        }
        if (rem2 > 2LL * Baseln) break;
    }
    // cout << "L1 = "; for (int i = 1; i <= M; i++) cout << L1[i] << " "; cout << endl;
    // cout << "L2 = "; for (int i = 1; i <= M; i++) cout << L2[i] << " "; cout << endl;
    // cout << "Cand1 = "; for (int i = 0; i < Cand1.size(); i++) cout << "(" << Cand1[i].first << "," << Cand1[i].second << ") "; cout << endl;
    // cout << "Cand2 = "; for (int i = 0; i < Cand2.size(); i++) cout << "(" << Cand2[i].first << "," << Cand2[i].second << ") "; cout << endl;

    // Step 6. Brute Force
    long long Answer = -(1LL << 60);
    for (pair<long long, long long> v1 : Cand1) {
        for (pair<long long, long long> v2 : Cand2) {
            long long diff = L - (v2.first - v1.first);
            if (diff < -Baseln || diff > Baseln) continue;
            if (dp3[diff + Baseln] == -(1LL << 60)) continue;
            Answer = max(Answer, v1.second + v2.second + dp3[diff + Baseln]);
        }
    }

    // Step 7. Output
    if (Answer == -(1LL << 60)) cout << "impossible" << endl;
    else cout << Answer + A[M] << endl;
}

int main() {
    // Input
    long long M, L;
    cin >> M >> L;
    vector<long long> A(2 * M + 1, 0);
    for (int i = 0; i <= 2 * M; i++) cin >> A[i];

    // Judge if Subtask 2
    bool Subtask2 = true;
    if (M > 100) Subtask2 = false;
    for (int i = 0; i <= 2 * M; i++) {
        if (A[i] > 100) Subtask2 = false;
    }

    // Execution
    if (Subtask2 == true) Solve_Subtask2(M, L, A);
    else Solve_Subtask3(M, L, A);
    return 0;
}

Compilation message

vault.cpp: In function 'std::vector<long long int> SolveDP(long long int, long long int, std::vector<long long int>, std::vector<long long int>)':
vault.cpp:20:36: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |                 while (maxi.size() >= cur + 1) {
      |                        ~~~~~~~~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 57 ms 47628 KB Output is correct
2 Correct 83 ms 45872 KB Output is correct
3 Correct 42 ms 44036 KB Output is correct
4 Correct 209 ms 45288 KB Output is correct
5 Correct 832 ms 47696 KB Output is correct
6 Correct 818 ms 47692 KB Output is correct
7 Correct 957 ms 44692 KB Output is correct
8 Correct 821 ms 47608 KB Output is correct
9 Correct 833 ms 46140 KB Output is correct
10 Correct 958 ms 44592 KB Output is correct
11 Correct 922 ms 44500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 47628 KB Output is correct
2 Correct 83 ms 45872 KB Output is correct
3 Correct 42 ms 44036 KB Output is correct
4 Correct 209 ms 45288 KB Output is correct
5 Correct 832 ms 47696 KB Output is correct
6 Correct 818 ms 47692 KB Output is correct
7 Correct 957 ms 44692 KB Output is correct
8 Correct 821 ms 47608 KB Output is correct
9 Correct 833 ms 46140 KB Output is correct
10 Correct 958 ms 44592 KB Output is correct
11 Correct 922 ms 44500 KB Output is correct
12 Correct 55 ms 45244 KB Output is correct
13 Correct 71 ms 44448 KB Output is correct
14 Correct 33 ms 47736 KB Output is correct
15 Correct 209 ms 44980 KB Output is correct
16 Correct 851 ms 45356 KB Output is correct
17 Correct 857 ms 46252 KB Output is correct
18 Correct 906 ms 44452 KB Output is correct
19 Correct 890 ms 44232 KB Output is correct
20 Correct 861 ms 45192 KB Output is correct
21 Correct 910 ms 45796 KB Output is correct
22 Correct 915 ms 45696 KB Output is correct
23 Correct 1703 ms 45844 KB Output is correct
24 Correct 1744 ms 45140 KB Output is correct
25 Correct 1836 ms 45404 KB Output is correct
26 Correct 1784 ms 45064 KB Output is correct
27 Correct 1697 ms 46072 KB Output is correct
28 Correct 1780 ms 45920 KB Output is correct
29 Correct 1824 ms 44252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 207 ms 45984 KB Output is correct
2 Correct 20 ms 2040 KB Output is correct
3 Correct 16 ms 1928 KB Output is correct
4 Correct 15 ms 2036 KB Output is correct
5 Correct 16 ms 1788 KB Output is correct
6 Correct 16 ms 1924 KB Output is correct
7 Correct 21 ms 1788 KB Output is correct
8 Correct 16 ms 1788 KB Output is correct
9 Correct 15 ms 1788 KB Output is correct
10 Correct 16 ms 1788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 207 ms 45984 KB Output is correct
2 Correct 20 ms 2040 KB Output is correct
3 Correct 16 ms 1928 KB Output is correct
4 Correct 15 ms 2036 KB Output is correct
5 Correct 16 ms 1788 KB Output is correct
6 Correct 16 ms 1924 KB Output is correct
7 Correct 21 ms 1788 KB Output is correct
8 Correct 16 ms 1788 KB Output is correct
9 Correct 15 ms 1788 KB Output is correct
10 Correct 16 ms 1788 KB Output is correct
11 Correct 52 ms 46136 KB Output is correct
12 Correct 74 ms 44984 KB Output is correct
13 Correct 32 ms 45808 KB Output is correct
14 Correct 202 ms 45772 KB Output is correct
15 Correct 21 ms 1788 KB Output is correct
16 Correct 16 ms 1788 KB Output is correct
17 Correct 16 ms 1784 KB Output is correct
18 Correct 15 ms 1788 KB Output is correct
19 Correct 15 ms 1788 KB Output is correct
20 Correct 16 ms 1788 KB Output is correct
21 Correct 16 ms 1848 KB Output is correct
22 Correct 16 ms 1784 KB Output is correct
23 Correct 21 ms 1788 KB Output is correct
24 Correct 15 ms 1784 KB Output is correct
25 Correct 16 ms 1784 KB Output is correct
26 Correct 20 ms 1784 KB Output is correct
27 Correct 16 ms 1788 KB Output is correct
28 Correct 25 ms 1932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 207 ms 45984 KB Output is correct
2 Correct 20 ms 2040 KB Output is correct
3 Correct 16 ms 1928 KB Output is correct
4 Correct 15 ms 2036 KB Output is correct
5 Correct 16 ms 1788 KB Output is correct
6 Correct 16 ms 1924 KB Output is correct
7 Correct 21 ms 1788 KB Output is correct
8 Correct 16 ms 1788 KB Output is correct
9 Correct 15 ms 1788 KB Output is correct
10 Correct 16 ms 1788 KB Output is correct
11 Correct 227 ms 46128 KB Output is correct
12 Correct 15 ms 1784 KB Output is correct
13 Correct 18 ms 1784 KB Output is correct
14 Correct 19 ms 1784 KB Output is correct
15 Correct 16 ms 1928 KB Output is correct
16 Correct 16 ms 1788 KB Output is correct
17 Correct 17 ms 1788 KB Output is correct
18 Correct 16 ms 1788 KB Output is correct
19 Correct 16 ms 1784 KB Output is correct
20 Correct 15 ms 1788 KB Output is correct
21 Correct 894 ms 44356 KB Output is correct
22 Correct 944 ms 45900 KB Output is correct
23 Correct 120 ms 6792 KB Output is correct
24 Correct 118 ms 6888 KB Output is correct
25 Correct 114 ms 6900 KB Output is correct
26 Correct 115 ms 6884 KB Output is correct
27 Correct 114 ms 6892 KB Output is correct
28 Correct 121 ms 6808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 47628 KB Output is correct
2 Correct 83 ms 45872 KB Output is correct
3 Correct 42 ms 44036 KB Output is correct
4 Correct 209 ms 45288 KB Output is correct
5 Correct 832 ms 47696 KB Output is correct
6 Correct 818 ms 47692 KB Output is correct
7 Correct 957 ms 44692 KB Output is correct
8 Correct 821 ms 47608 KB Output is correct
9 Correct 833 ms 46140 KB Output is correct
10 Correct 958 ms 44592 KB Output is correct
11 Correct 922 ms 44500 KB Output is correct
12 Correct 207 ms 45984 KB Output is correct
13 Correct 20 ms 2040 KB Output is correct
14 Correct 16 ms 1928 KB Output is correct
15 Correct 15 ms 2036 KB Output is correct
16 Correct 16 ms 1788 KB Output is correct
17 Correct 16 ms 1924 KB Output is correct
18 Correct 21 ms 1788 KB Output is correct
19 Correct 16 ms 1788 KB Output is correct
20 Correct 15 ms 1788 KB Output is correct
21 Correct 16 ms 1788 KB Output is correct
22 Correct 52 ms 46136 KB Output is correct
23 Correct 74 ms 44984 KB Output is correct
24 Correct 32 ms 45808 KB Output is correct
25 Correct 202 ms 45772 KB Output is correct
26 Correct 21 ms 1788 KB Output is correct
27 Correct 16 ms 1788 KB Output is correct
28 Correct 16 ms 1784 KB Output is correct
29 Correct 15 ms 1788 KB Output is correct
30 Correct 15 ms 1788 KB Output is correct
31 Correct 16 ms 1788 KB Output is correct
32 Correct 16 ms 1848 KB Output is correct
33 Correct 16 ms 1784 KB Output is correct
34 Correct 21 ms 1788 KB Output is correct
35 Correct 15 ms 1784 KB Output is correct
36 Correct 16 ms 1784 KB Output is correct
37 Correct 20 ms 1784 KB Output is correct
38 Correct 16 ms 1788 KB Output is correct
39 Correct 25 ms 1932 KB Output is correct
40 Correct 227 ms 46128 KB Output is correct
41 Correct 15 ms 1784 KB Output is correct
42 Correct 18 ms 1784 KB Output is correct
43 Correct 19 ms 1784 KB Output is correct
44 Correct 16 ms 1928 KB Output is correct
45 Correct 16 ms 1788 KB Output is correct
46 Correct 17 ms 1788 KB Output is correct
47 Correct 16 ms 1788 KB Output is correct
48 Correct 16 ms 1784 KB Output is correct
49 Correct 15 ms 1788 KB Output is correct
50 Correct 894 ms 44356 KB Output is correct
51 Correct 944 ms 45900 KB Output is correct
52 Correct 120 ms 6792 KB Output is correct
53 Correct 118 ms 6888 KB Output is correct
54 Correct 114 ms 6900 KB Output is correct
55 Correct 115 ms 6884 KB Output is correct
56 Correct 114 ms 6892 KB Output is correct
57 Correct 121 ms 6808 KB Output is correct
58 Correct 56 ms 45088 KB Output is correct
59 Correct 73 ms 45040 KB Output is correct
60 Correct 33 ms 44324 KB Output is correct
61 Correct 199 ms 46172 KB Output is correct
62 Correct 923 ms 47692 KB Output is correct
63 Correct 883 ms 45348 KB Output is correct
64 Correct 935 ms 44996 KB Output is correct
65 Correct 1042 ms 44832 KB Output is correct
66 Correct 816 ms 45328 KB Output is correct
67 Correct 999 ms 45360 KB Output is correct
68 Correct 987 ms 47696 KB Output is correct
69 Correct 16 ms 1788 KB Output is correct
70 Correct 16 ms 1788 KB Output is correct
71 Correct 16 ms 1992 KB Output is correct
72 Correct 15 ms 1788 KB Output is correct
73 Correct 15 ms 1788 KB Output is correct
74 Correct 16 ms 1788 KB Output is correct
75 Correct 16 ms 1788 KB Output is correct
76 Correct 17 ms 1788 KB Output is correct
77 Correct 15 ms 1784 KB Output is correct
78 Correct 17 ms 1788 KB Output is correct
79 Correct 16 ms 1788 KB Output is correct
80 Correct 19 ms 1788 KB Output is correct
81 Correct 15 ms 1788 KB Output is correct
82 Correct 26 ms 1788 KB Output is correct
83 Correct 113 ms 6812 KB Output is correct
84 Correct 131 ms 6884 KB Output is correct
85 Correct 116 ms 6888 KB Output is correct
86 Correct 113 ms 6888 KB Output is correct
87 Correct 148 ms 6884 KB Output is correct
88 Correct 114 ms 6808 KB Output is correct
89 Correct 116 ms 6936 KB Output is correct
90 Correct 117 ms 6888 KB Output is correct
91 Correct 127 ms 6884 KB Output is correct
92 Correct 243 ms 6792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 207 ms 45984 KB Output is correct
2 Correct 20 ms 2040 KB Output is correct
3 Correct 16 ms 1928 KB Output is correct
4 Correct 15 ms 2036 KB Output is correct
5 Correct 16 ms 1788 KB Output is correct
6 Correct 16 ms 1924 KB Output is correct
7 Correct 21 ms 1788 KB Output is correct
8 Correct 16 ms 1788 KB Output is correct
9 Correct 15 ms 1788 KB Output is correct
10 Correct 16 ms 1788 KB Output is correct
11 Correct 227 ms 46128 KB Output is correct
12 Correct 15 ms 1784 KB Output is correct
13 Correct 18 ms 1784 KB Output is correct
14 Correct 19 ms 1784 KB Output is correct
15 Correct 16 ms 1928 KB Output is correct
16 Correct 16 ms 1788 KB Output is correct
17 Correct 17 ms 1788 KB Output is correct
18 Correct 16 ms 1788 KB Output is correct
19 Correct 16 ms 1784 KB Output is correct
20 Correct 15 ms 1788 KB Output is correct
21 Correct 894 ms 44356 KB Output is correct
22 Correct 944 ms 45900 KB Output is correct
23 Correct 120 ms 6792 KB Output is correct
24 Correct 118 ms 6888 KB Output is correct
25 Correct 114 ms 6900 KB Output is correct
26 Correct 115 ms 6884 KB Output is correct
27 Correct 114 ms 6892 KB Output is correct
28 Correct 121 ms 6808 KB Output is correct
29 Correct 202 ms 46064 KB Output is correct
30 Correct 16 ms 1788 KB Output is correct
31 Correct 16 ms 1784 KB Output is correct
32 Correct 21 ms 1788 KB Output is correct
33 Correct 16 ms 1788 KB Output is correct
34 Correct 16 ms 1784 KB Output is correct
35 Correct 16 ms 1788 KB Output is correct
36 Correct 16 ms 1788 KB Output is correct
37 Correct 16 ms 1784 KB Output is correct
38 Correct 16 ms 1788 KB Output is correct
39 Correct 978 ms 44492 KB Output is correct
40 Correct 987 ms 46172 KB Output is correct
41 Correct 113 ms 6888 KB Output is correct
42 Correct 118 ms 6884 KB Output is correct
43 Correct 129 ms 6812 KB Output is correct
44 Correct 123 ms 6824 KB Output is correct
45 Correct 112 ms 6888 KB Output is correct
46 Correct 117 ms 6900 KB Output is correct
47 Correct 1851 ms 44632 KB Output is correct
48 Correct 1807 ms 46180 KB Output is correct
49 Correct 1934 ms 53080 KB Output is correct
50 Correct 2004 ms 53012 KB Output is correct
51 Correct 1876 ms 53516 KB Output is correct
52 Correct 1843 ms 54120 KB Output is correct
53 Correct 1868 ms 53604 KB Output is correct
54 Correct 1870 ms 54552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 47628 KB Output is correct
2 Correct 83 ms 45872 KB Output is correct
3 Correct 42 ms 44036 KB Output is correct
4 Correct 209 ms 45288 KB Output is correct
5 Correct 832 ms 47696 KB Output is correct
6 Correct 818 ms 47692 KB Output is correct
7 Correct 957 ms 44692 KB Output is correct
8 Correct 821 ms 47608 KB Output is correct
9 Correct 833 ms 46140 KB Output is correct
10 Correct 958 ms 44592 KB Output is correct
11 Correct 922 ms 44500 KB Output is correct
12 Correct 55 ms 45244 KB Output is correct
13 Correct 71 ms 44448 KB Output is correct
14 Correct 33 ms 47736 KB Output is correct
15 Correct 209 ms 44980 KB Output is correct
16 Correct 851 ms 45356 KB Output is correct
17 Correct 857 ms 46252 KB Output is correct
18 Correct 906 ms 44452 KB Output is correct
19 Correct 890 ms 44232 KB Output is correct
20 Correct 861 ms 45192 KB Output is correct
21 Correct 910 ms 45796 KB Output is correct
22 Correct 915 ms 45696 KB Output is correct
23 Correct 1703 ms 45844 KB Output is correct
24 Correct 1744 ms 45140 KB Output is correct
25 Correct 1836 ms 45404 KB Output is correct
26 Correct 1784 ms 45064 KB Output is correct
27 Correct 1697 ms 46072 KB Output is correct
28 Correct 1780 ms 45920 KB Output is correct
29 Correct 1824 ms 44252 KB Output is correct
30 Correct 207 ms 45984 KB Output is correct
31 Correct 20 ms 2040 KB Output is correct
32 Correct 16 ms 1928 KB Output is correct
33 Correct 15 ms 2036 KB Output is correct
34 Correct 16 ms 1788 KB Output is correct
35 Correct 16 ms 1924 KB Output is correct
36 Correct 21 ms 1788 KB Output is correct
37 Correct 16 ms 1788 KB Output is correct
38 Correct 15 ms 1788 KB Output is correct
39 Correct 16 ms 1788 KB Output is correct
40 Correct 52 ms 46136 KB Output is correct
41 Correct 74 ms 44984 KB Output is correct
42 Correct 32 ms 45808 KB Output is correct
43 Correct 202 ms 45772 KB Output is correct
44 Correct 21 ms 1788 KB Output is correct
45 Correct 16 ms 1788 KB Output is correct
46 Correct 16 ms 1784 KB Output is correct
47 Correct 15 ms 1788 KB Output is correct
48 Correct 15 ms 1788 KB Output is correct
49 Correct 16 ms 1788 KB Output is correct
50 Correct 16 ms 1848 KB Output is correct
51 Correct 16 ms 1784 KB Output is correct
52 Correct 21 ms 1788 KB Output is correct
53 Correct 15 ms 1784 KB Output is correct
54 Correct 16 ms 1784 KB Output is correct
55 Correct 20 ms 1784 KB Output is correct
56 Correct 16 ms 1788 KB Output is correct
57 Correct 25 ms 1932 KB Output is correct
58 Correct 227 ms 46128 KB Output is correct
59 Correct 15 ms 1784 KB Output is correct
60 Correct 18 ms 1784 KB Output is correct
61 Correct 19 ms 1784 KB Output is correct
62 Correct 16 ms 1928 KB Output is correct
63 Correct 16 ms 1788 KB Output is correct
64 Correct 17 ms 1788 KB Output is correct
65 Correct 16 ms 1788 KB Output is correct
66 Correct 16 ms 1784 KB Output is correct
67 Correct 15 ms 1788 KB Output is correct
68 Correct 894 ms 44356 KB Output is correct
69 Correct 944 ms 45900 KB Output is correct
70 Correct 120 ms 6792 KB Output is correct
71 Correct 118 ms 6888 KB Output is correct
72 Correct 114 ms 6900 KB Output is correct
73 Correct 115 ms 6884 KB Output is correct
74 Correct 114 ms 6892 KB Output is correct
75 Correct 121 ms 6808 KB Output is correct
76 Correct 56 ms 45088 KB Output is correct
77 Correct 73 ms 45040 KB Output is correct
78 Correct 33 ms 44324 KB Output is correct
79 Correct 199 ms 46172 KB Output is correct
80 Correct 923 ms 47692 KB Output is correct
81 Correct 883 ms 45348 KB Output is correct
82 Correct 935 ms 44996 KB Output is correct
83 Correct 1042 ms 44832 KB Output is correct
84 Correct 816 ms 45328 KB Output is correct
85 Correct 999 ms 45360 KB Output is correct
86 Correct 987 ms 47696 KB Output is correct
87 Correct 16 ms 1788 KB Output is correct
88 Correct 16 ms 1788 KB Output is correct
89 Correct 16 ms 1992 KB Output is correct
90 Correct 15 ms 1788 KB Output is correct
91 Correct 15 ms 1788 KB Output is correct
92 Correct 16 ms 1788 KB Output is correct
93 Correct 16 ms 1788 KB Output is correct
94 Correct 17 ms 1788 KB Output is correct
95 Correct 15 ms 1784 KB Output is correct
96 Correct 17 ms 1788 KB Output is correct
97 Correct 16 ms 1788 KB Output is correct
98 Correct 19 ms 1788 KB Output is correct
99 Correct 15 ms 1788 KB Output is correct
100 Correct 26 ms 1788 KB Output is correct
101 Correct 113 ms 6812 KB Output is correct
102 Correct 131 ms 6884 KB Output is correct
103 Correct 116 ms 6888 KB Output is correct
104 Correct 113 ms 6888 KB Output is correct
105 Correct 148 ms 6884 KB Output is correct
106 Correct 114 ms 6808 KB Output is correct
107 Correct 116 ms 6936 KB Output is correct
108 Correct 117 ms 6888 KB Output is correct
109 Correct 127 ms 6884 KB Output is correct
110 Correct 243 ms 6792 KB Output is correct
111 Correct 202 ms 46064 KB Output is correct
112 Correct 16 ms 1788 KB Output is correct
113 Correct 16 ms 1784 KB Output is correct
114 Correct 21 ms 1788 KB Output is correct
115 Correct 16 ms 1788 KB Output is correct
116 Correct 16 ms 1784 KB Output is correct
117 Correct 16 ms 1788 KB Output is correct
118 Correct 16 ms 1788 KB Output is correct
119 Correct 16 ms 1784 KB Output is correct
120 Correct 16 ms 1788 KB Output is correct
121 Correct 978 ms 44492 KB Output is correct
122 Correct 987 ms 46172 KB Output is correct
123 Correct 113 ms 6888 KB Output is correct
124 Correct 118 ms 6884 KB Output is correct
125 Correct 129 ms 6812 KB Output is correct
126 Correct 123 ms 6824 KB Output is correct
127 Correct 112 ms 6888 KB Output is correct
128 Correct 117 ms 6900 KB Output is correct
129 Correct 1851 ms 44632 KB Output is correct
130 Correct 1807 ms 46180 KB Output is correct
131 Correct 1934 ms 53080 KB Output is correct
132 Correct 2004 ms 53012 KB Output is correct
133 Correct 1876 ms 53516 KB Output is correct
134 Correct 1843 ms 54120 KB Output is correct
135 Correct 1868 ms 53604 KB Output is correct
136 Correct 1870 ms 54552 KB Output is correct
137 Correct 57 ms 44560 KB Output is correct
138 Correct 72 ms 45232 KB Output is correct
139 Correct 34 ms 44824 KB Output is correct
140 Correct 196 ms 46148 KB Output is correct
141 Correct 838 ms 44916 KB Output is correct
142 Correct 844 ms 44436 KB Output is correct
143 Correct 857 ms 44380 KB Output is correct
144 Correct 842 ms 47784 KB Output is correct
145 Correct 807 ms 45392 KB Output is correct
146 Correct 887 ms 45308 KB Output is correct
147 Correct 891 ms 45984 KB Output is correct
148 Correct 1666 ms 44764 KB Output is correct
149 Correct 1690 ms 44544 KB Output is correct
150 Correct 1689 ms 47704 KB Output is correct
151 Correct 1603 ms 45036 KB Output is correct
152 Correct 1616 ms 45696 KB Output is correct
153 Correct 1756 ms 45188 KB Output is correct
154 Correct 1749 ms 45232 KB Output is correct
155 Correct 15 ms 1788 KB Output is correct
156 Correct 16 ms 1788 KB Output is correct
157 Correct 15 ms 1788 KB Output is correct
158 Correct 16 ms 1788 KB Output is correct
159 Correct 15 ms 1788 KB Output is correct
160 Correct 16 ms 1788 KB Output is correct
161 Correct 17 ms 1788 KB Output is correct
162 Correct 16 ms 1788 KB Output is correct
163 Correct 16 ms 1788 KB Output is correct
164 Correct 113 ms 6800 KB Output is correct
165 Correct 118 ms 6808 KB Output is correct
166 Correct 114 ms 6892 KB Output is correct
167 Correct 114 ms 6888 KB Output is correct
168 Correct 116 ms 6888 KB Output is correct
169 Correct 114 ms 6888 KB Output is correct
170 Correct 15 ms 1784 KB Output is correct
171 Correct 16 ms 1928 KB Output is correct
172 Correct 18 ms 1788 KB Output is correct
173 Correct 16 ms 1788 KB Output is correct
174 Correct 25 ms 1788 KB Output is correct
175 Correct 114 ms 6804 KB Output is correct
176 Correct 120 ms 6804 KB Output is correct
177 Correct 122 ms 6900 KB Output is correct
178 Correct 241 ms 6888 KB Output is correct
179 Correct 1919 ms 53776 KB Output is correct
180 Correct 1902 ms 52524 KB Output is correct
181 Correct 1828 ms 52748 KB Output is correct
182 Correct 1798 ms 54372 KB Output is correct
183 Correct 1839 ms 53604 KB Output is correct
184 Correct 1861 ms 52808 KB Output is correct
185 Correct 1903 ms 53096 KB Output is correct
186 Correct 1985 ms 53092 KB Output is correct
187 Correct 2440 ms 53460 KB Output is correct
188 Execution timed out 5010 ms 53348 KB Time limit exceeded
189 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 207 ms 45984 KB Output is correct
2 Correct 20 ms 2040 KB Output is correct
3 Correct 16 ms 1928 KB Output is correct
4 Correct 15 ms 2036 KB Output is correct
5 Correct 16 ms 1788 KB Output is correct
6 Correct 16 ms 1924 KB Output is correct
7 Correct 21 ms 1788 KB Output is correct
8 Correct 16 ms 1788 KB Output is correct
9 Correct 15 ms 1788 KB Output is correct
10 Correct 16 ms 1788 KB Output is correct
11 Correct 227 ms 46128 KB Output is correct
12 Correct 15 ms 1784 KB Output is correct
13 Correct 18 ms 1784 KB Output is correct
14 Correct 19 ms 1784 KB Output is correct
15 Correct 16 ms 1928 KB Output is correct
16 Correct 16 ms 1788 KB Output is correct
17 Correct 17 ms 1788 KB Output is correct
18 Correct 16 ms 1788 KB Output is correct
19 Correct 16 ms 1784 KB Output is correct
20 Correct 15 ms 1788 KB Output is correct
21 Correct 894 ms 44356 KB Output is correct
22 Correct 944 ms 45900 KB Output is correct
23 Correct 120 ms 6792 KB Output is correct
24 Correct 118 ms 6888 KB Output is correct
25 Correct 114 ms 6900 KB Output is correct
26 Correct 115 ms 6884 KB Output is correct
27 Correct 114 ms 6892 KB Output is correct
28 Correct 121 ms 6808 KB Output is correct
29 Correct 202 ms 46064 KB Output is correct
30 Correct 16 ms 1788 KB Output is correct
31 Correct 16 ms 1784 KB Output is correct
32 Correct 21 ms 1788 KB Output is correct
33 Correct 16 ms 1788 KB Output is correct
34 Correct 16 ms 1784 KB Output is correct
35 Correct 16 ms 1788 KB Output is correct
36 Correct 16 ms 1788 KB Output is correct
37 Correct 16 ms 1784 KB Output is correct
38 Correct 16 ms 1788 KB Output is correct
39 Correct 978 ms 44492 KB Output is correct
40 Correct 987 ms 46172 KB Output is correct
41 Correct 113 ms 6888 KB Output is correct
42 Correct 118 ms 6884 KB Output is correct
43 Correct 129 ms 6812 KB Output is correct
44 Correct 123 ms 6824 KB Output is correct
45 Correct 112 ms 6888 KB Output is correct
46 Correct 117 ms 6900 KB Output is correct
47 Correct 1851 ms 44632 KB Output is correct
48 Correct 1807 ms 46180 KB Output is correct
49 Correct 1934 ms 53080 KB Output is correct
50 Correct 2004 ms 53012 KB Output is correct
51 Correct 1876 ms 53516 KB Output is correct
52 Correct 1843 ms 54120 KB Output is correct
53 Correct 1868 ms 53604 KB Output is correct
54 Correct 1870 ms 54552 KB Output is correct
55 Correct 190 ms 45068 KB Output is correct
56 Correct 16 ms 1788 KB Output is correct
57 Correct 16 ms 1788 KB Output is correct
58 Correct 15 ms 2040 KB Output is correct
59 Correct 15 ms 1788 KB Output is correct
60 Correct 16 ms 1788 KB Output is correct
61 Correct 16 ms 1784 KB Output is correct
62 Correct 16 ms 1928 KB Output is correct
63 Correct 15 ms 1784 KB Output is correct
64 Correct 16 ms 1788 KB Output is correct
65 Correct 900 ms 45728 KB Output is correct
66 Correct 888 ms 45804 KB Output is correct
67 Correct 112 ms 6900 KB Output is correct
68 Correct 117 ms 6804 KB Output is correct
69 Correct 112 ms 6788 KB Output is correct
70 Correct 114 ms 6792 KB Output is correct
71 Correct 114 ms 6892 KB Output is correct
72 Correct 115 ms 6884 KB Output is correct
73 Correct 1749 ms 45268 KB Output is correct
74 Correct 1837 ms 45556 KB Output is correct
75 Correct 1974 ms 54632 KB Output is correct
76 Correct 2000 ms 54288 KB Output is correct
77 Correct 1908 ms 54288 KB Output is correct
78 Correct 1891 ms 53352 KB Output is correct
79 Correct 1966 ms 53004 KB Output is correct
80 Correct 1970 ms 54372 KB Output is correct
81 Execution timed out 5084 ms 476812 KB Time limit exceeded
82 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 57 ms 47628 KB Output is correct
2 Correct 83 ms 45872 KB Output is correct
3 Correct 42 ms 44036 KB Output is correct
4 Correct 209 ms 45288 KB Output is correct
5 Correct 832 ms 47696 KB Output is correct
6 Correct 818 ms 47692 KB Output is correct
7 Correct 957 ms 44692 KB Output is correct
8 Correct 821 ms 47608 KB Output is correct
9 Correct 833 ms 46140 KB Output is correct
10 Correct 958 ms 44592 KB Output is correct
11 Correct 922 ms 44500 KB Output is correct
12 Correct 55 ms 45244 KB Output is correct
13 Correct 71 ms 44448 KB Output is correct
14 Correct 33 ms 47736 KB Output is correct
15 Correct 209 ms 44980 KB Output is correct
16 Correct 851 ms 45356 KB Output is correct
17 Correct 857 ms 46252 KB Output is correct
18 Correct 906 ms 44452 KB Output is correct
19 Correct 890 ms 44232 KB Output is correct
20 Correct 861 ms 45192 KB Output is correct
21 Correct 910 ms 45796 KB Output is correct
22 Correct 915 ms 45696 KB Output is correct
23 Correct 1703 ms 45844 KB Output is correct
24 Correct 1744 ms 45140 KB Output is correct
25 Correct 1836 ms 45404 KB Output is correct
26 Correct 1784 ms 45064 KB Output is correct
27 Correct 1697 ms 46072 KB Output is correct
28 Correct 1780 ms 45920 KB Output is correct
29 Correct 1824 ms 44252 KB Output is correct
30 Correct 207 ms 45984 KB Output is correct
31 Correct 20 ms 2040 KB Output is correct
32 Correct 16 ms 1928 KB Output is correct
33 Correct 15 ms 2036 KB Output is correct
34 Correct 16 ms 1788 KB Output is correct
35 Correct 16 ms 1924 KB Output is correct
36 Correct 21 ms 1788 KB Output is correct
37 Correct 16 ms 1788 KB Output is correct
38 Correct 15 ms 1788 KB Output is correct
39 Correct 16 ms 1788 KB Output is correct
40 Correct 52 ms 46136 KB Output is correct
41 Correct 74 ms 44984 KB Output is correct
42 Correct 32 ms 45808 KB Output is correct
43 Correct 202 ms 45772 KB Output is correct
44 Correct 21 ms 1788 KB Output is correct
45 Correct 16 ms 1788 KB Output is correct
46 Correct 16 ms 1784 KB Output is correct
47 Correct 15 ms 1788 KB Output is correct
48 Correct 15 ms 1788 KB Output is correct
49 Correct 16 ms 1788 KB Output is correct
50 Correct 16 ms 1848 KB Output is correct
51 Correct 16 ms 1784 KB Output is correct
52 Correct 21 ms 1788 KB Output is correct
53 Correct 15 ms 1784 KB Output is correct
54 Correct 16 ms 1784 KB Output is correct
55 Correct 20 ms 1784 KB Output is correct
56 Correct 16 ms 1788 KB Output is correct
57 Correct 25 ms 1932 KB Output is correct
58 Correct 227 ms 46128 KB Output is correct
59 Correct 15 ms 1784 KB Output is correct
60 Correct 18 ms 1784 KB Output is correct
61 Correct 19 ms 1784 KB Output is correct
62 Correct 16 ms 1928 KB Output is correct
63 Correct 16 ms 1788 KB Output is correct
64 Correct 17 ms 1788 KB Output is correct
65 Correct 16 ms 1788 KB Output is correct
66 Correct 16 ms 1784 KB Output is correct
67 Correct 15 ms 1788 KB Output is correct
68 Correct 894 ms 44356 KB Output is correct
69 Correct 944 ms 45900 KB Output is correct
70 Correct 120 ms 6792 KB Output is correct
71 Correct 118 ms 6888 KB Output is correct
72 Correct 114 ms 6900 KB Output is correct
73 Correct 115 ms 6884 KB Output is correct
74 Correct 114 ms 6892 KB Output is correct
75 Correct 121 ms 6808 KB Output is correct
76 Correct 56 ms 45088 KB Output is correct
77 Correct 73 ms 45040 KB Output is correct
78 Correct 33 ms 44324 KB Output is correct
79 Correct 199 ms 46172 KB Output is correct
80 Correct 923 ms 47692 KB Output is correct
81 Correct 883 ms 45348 KB Output is correct
82 Correct 935 ms 44996 KB Output is correct
83 Correct 1042 ms 44832 KB Output is correct
84 Correct 816 ms 45328 KB Output is correct
85 Correct 999 ms 45360 KB Output is correct
86 Correct 987 ms 47696 KB Output is correct
87 Correct 16 ms 1788 KB Output is correct
88 Correct 16 ms 1788 KB Output is correct
89 Correct 16 ms 1992 KB Output is correct
90 Correct 15 ms 1788 KB Output is correct
91 Correct 15 ms 1788 KB Output is correct
92 Correct 16 ms 1788 KB Output is correct
93 Correct 16 ms 1788 KB Output is correct
94 Correct 17 ms 1788 KB Output is correct
95 Correct 15 ms 1784 KB Output is correct
96 Correct 17 ms 1788 KB Output is correct
97 Correct 16 ms 1788 KB Output is correct
98 Correct 19 ms 1788 KB Output is correct
99 Correct 15 ms 1788 KB Output is correct
100 Correct 26 ms 1788 KB Output is correct
101 Correct 113 ms 6812 KB Output is correct
102 Correct 131 ms 6884 KB Output is correct
103 Correct 116 ms 6888 KB Output is correct
104 Correct 113 ms 6888 KB Output is correct
105 Correct 148 ms 6884 KB Output is correct
106 Correct 114 ms 6808 KB Output is correct
107 Correct 116 ms 6936 KB Output is correct
108 Correct 117 ms 6888 KB Output is correct
109 Correct 127 ms 6884 KB Output is correct
110 Correct 243 ms 6792 KB Output is correct
111 Correct 202 ms 46064 KB Output is correct
112 Correct 16 ms 1788 KB Output is correct
113 Correct 16 ms 1784 KB Output is correct
114 Correct 21 ms 1788 KB Output is correct
115 Correct 16 ms 1788 KB Output is correct
116 Correct 16 ms 1784 KB Output is correct
117 Correct 16 ms 1788 KB Output is correct
118 Correct 16 ms 1788 KB Output is correct
119 Correct 16 ms 1784 KB Output is correct
120 Correct 16 ms 1788 KB Output is correct
121 Correct 978 ms 44492 KB Output is correct
122 Correct 987 ms 46172 KB Output is correct
123 Correct 113 ms 6888 KB Output is correct
124 Correct 118 ms 6884 KB Output is correct
125 Correct 129 ms 6812 KB Output is correct
126 Correct 123 ms 6824 KB Output is correct
127 Correct 112 ms 6888 KB Output is correct
128 Correct 117 ms 6900 KB Output is correct
129 Correct 1851 ms 44632 KB Output is correct
130 Correct 1807 ms 46180 KB Output is correct
131 Correct 1934 ms 53080 KB Output is correct
132 Correct 2004 ms 53012 KB Output is correct
133 Correct 1876 ms 53516 KB Output is correct
134 Correct 1843 ms 54120 KB Output is correct
135 Correct 1868 ms 53604 KB Output is correct
136 Correct 1870 ms 54552 KB Output is correct
137 Correct 57 ms 44560 KB Output is correct
138 Correct 72 ms 45232 KB Output is correct
139 Correct 34 ms 44824 KB Output is correct
140 Correct 196 ms 46148 KB Output is correct
141 Correct 838 ms 44916 KB Output is correct
142 Correct 844 ms 44436 KB Output is correct
143 Correct 857 ms 44380 KB Output is correct
144 Correct 842 ms 47784 KB Output is correct
145 Correct 807 ms 45392 KB Output is correct
146 Correct 887 ms 45308 KB Output is correct
147 Correct 891 ms 45984 KB Output is correct
148 Correct 1666 ms 44764 KB Output is correct
149 Correct 1690 ms 44544 KB Output is correct
150 Correct 1689 ms 47704 KB Output is correct
151 Correct 1603 ms 45036 KB Output is correct
152 Correct 1616 ms 45696 KB Output is correct
153 Correct 1756 ms 45188 KB Output is correct
154 Correct 1749 ms 45232 KB Output is correct
155 Correct 15 ms 1788 KB Output is correct
156 Correct 16 ms 1788 KB Output is correct
157 Correct 15 ms 1788 KB Output is correct
158 Correct 16 ms 1788 KB Output is correct
159 Correct 15 ms 1788 KB Output is correct
160 Correct 16 ms 1788 KB Output is correct
161 Correct 17 ms 1788 KB Output is correct
162 Correct 16 ms 1788 KB Output is correct
163 Correct 16 ms 1788 KB Output is correct
164 Correct 113 ms 6800 KB Output is correct
165 Correct 118 ms 6808 KB Output is correct
166 Correct 114 ms 6892 KB Output is correct
167 Correct 114 ms 6888 KB Output is correct
168 Correct 116 ms 6888 KB Output is correct
169 Correct 114 ms 6888 KB Output is correct
170 Correct 15 ms 1784 KB Output is correct
171 Correct 16 ms 1928 KB Output is correct
172 Correct 18 ms 1788 KB Output is correct
173 Correct 16 ms 1788 KB Output is correct
174 Correct 25 ms 1788 KB Output is correct
175 Correct 114 ms 6804 KB Output is correct
176 Correct 120 ms 6804 KB Output is correct
177 Correct 122 ms 6900 KB Output is correct
178 Correct 241 ms 6888 KB Output is correct
179 Correct 1919 ms 53776 KB Output is correct
180 Correct 1902 ms 52524 KB Output is correct
181 Correct 1828 ms 52748 KB Output is correct
182 Correct 1798 ms 54372 KB Output is correct
183 Correct 1839 ms 53604 KB Output is correct
184 Correct 1861 ms 52808 KB Output is correct
185 Correct 1903 ms 53096 KB Output is correct
186 Correct 1985 ms 53092 KB Output is correct
187 Correct 2440 ms 53460 KB Output is correct
188 Execution timed out 5010 ms 53348 KB Time limit exceeded
189 Halted 0 ms 0 KB -