Submission #860654

# Submission time Handle Problem Language Result Execution time Memory
860654 2023-10-13T15:55:34 Z E869120 Uplifting Excursion (BOI22_vault) C++14
80 / 100
5000 ms 100260 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;
}

vector<long long> SolveDP2(long long N, long long LIM, vector<long long> List) {
    vector<long long> dp(LIM + 1, -(1LL << 60));
    vector<long long> ret(N, 0);
    dp[0] = 0;
 
    // DP Start
    for (int i = N - 1; i >= 0; i--) {
        for (int j = 1; j <= min(N, List[i]); j++) {
            if (dp[(i + 1) * j] == -(1LL << 60)) ret[i] += 1;
            else break;
        }
        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 ret;
}

long long Solve_Subtask6(long long M, long long L, vector<long long> A) {
    vector<long long> M0(M, 0), M1(M, 0), M2(M, 0), M3(M, 0); // Minus
    vector<long long> P0(M, 0), P1(M, 0), P2(M, 0), P3(M, 0); // Minus

    // Step 1. First DP
    for (int i = 0; i < M; i++) M0[i] = A[M - 1 - i];
    for (int i = 0; i < M; i++) P0[i] = A[M + 1 + i];
    M1 = SolveDP2(M, M * M + 1, M0);
    P1 = SolveDP2(M, M * M + 1, P0);

    // Step 2. Calculate Sum
    long long sumM = 0; for (int i = 0; i < M; i++) sumM += 1LL * (i + 1) * (M0[i] - M1[i]);
    long long sumP = 0; for (int i = 0; i < M; i++) sumP += 1LL * (i + 1) * (P0[i] - P1[i]);
    long long Offset = 4LL * M * M;
    long long Answer = 0;
    long long Actual = 0;
    if (sumP - sumM > L) sumP = sumM + L;
    else sumM = sumP - L;

    // Step 3. Greedy
    for (int i = 0; i < M; i++) {
        M2[i] = min(M0[i] - M1[i], max(0LL, sumM - Offset) / (i + 1));
        Answer += M2[i];
        sumM   -= 1LL * (i + 1) * M2[i];
        Actual -= 1LL * (i + 1) * M2[i];
        M3[i] = M0[i] - M2[i]; 
    }
    for (int i = 0; i < M; i++) {
        P2[i] = min(P0[i] - P1[i], max(0LL, sumP - Offset) / (i + 1));
        Answer += P2[i];
        sumP   -= 1LL * (i + 1) * P2[i];
        Actual += 1LL * (i + 1) * P2[i];
        P3[i] = P0[i] - P2[i]; 
    }

    // Step 4. Get Maximum
    long long Maximum = Offset + M * M;
    for (int i = 0; i < M; i++) Maximum += 1LL * (i + 1) * M1[i];
    for (int i = 0; i < M; i++) Maximum += 1LL * (i + 1) * P1[i];
    if (abs(Actual - L) > Maximum) return -1;

    // Step 5. Get Answer
    vector<long long> dp1 = SolveDP(M, Maximum, M3, vector<long long>{});
    vector<long long> dp2 = vector<long long>(Maximum + 1, -(1LL << 60));
    for (int i = 0; i <= Maximum; i++) dp2[Maximum - i] = dp1[i];
    vector<long long> dp3 = SolveDP(M, Maximum * 2, P3, dp2);
    if (dp3[Maximum + L - Actual] == -(1LL << 60)) return -1;
    return dp3[Maximum + L - Actual] + A[M] + Answer;
}
 
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];

    // Output
    long long Answer = Solve_Subtask6(M, L, A);
    if (Answer == -1) cout << "impossible" << endl;
    else cout << Answer << endl;
    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) {
      |                        ~~~~~~~~~~~~^~~~~~~~~~
vault.cpp: In function 'std::vector<long long int> SolveDP2(long long int, long long int, std::vector<long long int>)':
vault.cpp:54: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]
   54 |                 while (maxi.size() >= cur + 1) {
      |                        ~~~~~~~~~~~~^~~~~~~~~~
# 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 1 ms 504 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 51 ms 3408 KB Output is correct
7 Correct 43 ms 3052 KB Output is correct
8 Correct 50 ms 3404 KB Output is correct
9 Correct 60 ms 5304 KB Output is correct
10 Correct 35 ms 2876 KB Output is correct
11 Correct 34 ms 2888 KB Output is correct
# 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 1 ms 504 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 51 ms 3408 KB Output is correct
7 Correct 43 ms 3052 KB Output is correct
8 Correct 50 ms 3404 KB Output is correct
9 Correct 60 ms 5304 KB Output is correct
10 Correct 35 ms 2876 KB Output is correct
11 Correct 34 ms 2888 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 3 ms 576 KB Output is correct
17 Correct 49 ms 3412 KB Output is correct
18 Correct 40 ms 2924 KB Output is correct
19 Correct 50 ms 3408 KB Output is correct
20 Correct 61 ms 5316 KB Output is correct
21 Correct 34 ms 2876 KB Output is correct
22 Correct 34 ms 2892 KB Output is correct
23 Correct 23 ms 996 KB Output is correct
24 Correct 479 ms 21316 KB Output is correct
25 Correct 368 ms 12888 KB Output is correct
26 Correct 526 ms 21560 KB Output is correct
27 Correct 522 ms 22400 KB Output is correct
28 Correct 272 ms 12016 KB Output is correct
29 Correct 280 ms 12044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 9 ms 1144 KB Output is correct
3 Correct 8 ms 1080 KB Output is correct
4 Correct 9 ms 1140 KB Output is correct
5 Correct 9 ms 1232 KB Output is correct
6 Correct 9 ms 1152 KB Output is correct
7 Correct 8 ms 1060 KB Output is correct
8 Correct 7 ms 960 KB Output is correct
9 Correct 9 ms 964 KB Output is correct
10 Correct 7 ms 968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 9 ms 1144 KB Output is correct
3 Correct 8 ms 1080 KB Output is correct
4 Correct 9 ms 1140 KB Output is correct
5 Correct 9 ms 1232 KB Output is correct
6 Correct 9 ms 1152 KB Output is correct
7 Correct 8 ms 1060 KB Output is correct
8 Correct 7 ms 960 KB Output is correct
9 Correct 9 ms 964 KB Output is correct
10 Correct 7 ms 968 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 9 ms 1404 KB Output is correct
16 Correct 8 ms 1080 KB Output is correct
17 Correct 9 ms 1140 KB Output is correct
18 Correct 11 ms 1232 KB Output is correct
19 Correct 8 ms 1152 KB Output is correct
20 Correct 8 ms 1192 KB Output is correct
21 Correct 7 ms 1084 KB Output is correct
22 Correct 9 ms 968 KB Output is correct
23 Correct 7 ms 968 KB Output is correct
24 Correct 12 ms 1840 KB Output is correct
25 Correct 9 ms 1124 KB Output is correct
26 Correct 15 ms 1836 KB Output is correct
27 Correct 13 ms 1592 KB Output is correct
28 Correct 12 ms 1596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 9 ms 1144 KB Output is correct
3 Correct 8 ms 1080 KB Output is correct
4 Correct 9 ms 1140 KB Output is correct
5 Correct 9 ms 1232 KB Output is correct
6 Correct 9 ms 1152 KB Output is correct
7 Correct 8 ms 1060 KB Output is correct
8 Correct 7 ms 960 KB Output is correct
9 Correct 9 ms 964 KB Output is correct
10 Correct 7 ms 968 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 8 ms 1116 KB Output is correct
13 Correct 8 ms 1080 KB Output is correct
14 Correct 9 ms 1140 KB Output is correct
15 Correct 9 ms 1232 KB Output is correct
16 Correct 8 ms 1152 KB Output is correct
17 Correct 8 ms 1060 KB Output is correct
18 Correct 7 ms 960 KB Output is correct
19 Correct 9 ms 968 KB Output is correct
20 Correct 7 ms 968 KB Output is correct
21 Correct 40 ms 2876 KB Output is correct
22 Correct 33 ms 3144 KB Output is correct
23 Correct 42 ms 3008 KB Output is correct
24 Correct 39 ms 2988 KB Output is correct
25 Correct 38 ms 3060 KB Output is correct
26 Correct 45 ms 3256 KB Output is correct
27 Correct 42 ms 3032 KB Output is correct
28 Correct 34 ms 3140 KB Output is correct
# 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 1 ms 504 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 51 ms 3408 KB Output is correct
7 Correct 43 ms 3052 KB Output is correct
8 Correct 50 ms 3404 KB Output is correct
9 Correct 60 ms 5304 KB Output is correct
10 Correct 35 ms 2876 KB Output is correct
11 Correct 34 ms 2888 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 9 ms 1144 KB Output is correct
14 Correct 8 ms 1080 KB Output is correct
15 Correct 9 ms 1140 KB Output is correct
16 Correct 9 ms 1232 KB Output is correct
17 Correct 9 ms 1152 KB Output is correct
18 Correct 8 ms 1060 KB Output is correct
19 Correct 7 ms 960 KB Output is correct
20 Correct 9 ms 964 KB Output is correct
21 Correct 7 ms 968 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 9 ms 1404 KB Output is correct
27 Correct 8 ms 1080 KB Output is correct
28 Correct 9 ms 1140 KB Output is correct
29 Correct 11 ms 1232 KB Output is correct
30 Correct 8 ms 1152 KB Output is correct
31 Correct 8 ms 1192 KB Output is correct
32 Correct 7 ms 1084 KB Output is correct
33 Correct 9 ms 968 KB Output is correct
34 Correct 7 ms 968 KB Output is correct
35 Correct 12 ms 1840 KB Output is correct
36 Correct 9 ms 1124 KB Output is correct
37 Correct 15 ms 1836 KB Output is correct
38 Correct 13 ms 1592 KB Output is correct
39 Correct 12 ms 1596 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 8 ms 1116 KB Output is correct
42 Correct 8 ms 1080 KB Output is correct
43 Correct 9 ms 1140 KB Output is correct
44 Correct 9 ms 1232 KB Output is correct
45 Correct 8 ms 1152 KB Output is correct
46 Correct 8 ms 1060 KB Output is correct
47 Correct 7 ms 960 KB Output is correct
48 Correct 9 ms 968 KB Output is correct
49 Correct 7 ms 968 KB Output is correct
50 Correct 40 ms 2876 KB Output is correct
51 Correct 33 ms 3144 KB Output is correct
52 Correct 42 ms 3008 KB Output is correct
53 Correct 39 ms 2988 KB Output is correct
54 Correct 38 ms 3060 KB Output is correct
55 Correct 45 ms 3256 KB Output is correct
56 Correct 42 ms 3032 KB Output is correct
57 Correct 34 ms 3140 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 3 ms 348 KB Output is correct
63 Correct 49 ms 3456 KB Output is correct
64 Correct 40 ms 3048 KB Output is correct
65 Correct 53 ms 3668 KB Output is correct
66 Correct 61 ms 5300 KB Output is correct
67 Correct 35 ms 2876 KB Output is correct
68 Correct 34 ms 2892 KB Output is correct
69 Correct 9 ms 1152 KB Output is correct
70 Correct 8 ms 1080 KB Output is correct
71 Correct 9 ms 1140 KB Output is correct
72 Correct 9 ms 1232 KB Output is correct
73 Correct 8 ms 1152 KB Output is correct
74 Correct 8 ms 1060 KB Output is correct
75 Correct 7 ms 960 KB Output is correct
76 Correct 7 ms 964 KB Output is correct
77 Correct 7 ms 968 KB Output is correct
78 Correct 12 ms 1588 KB Output is correct
79 Correct 9 ms 1124 KB Output is correct
80 Correct 13 ms 1620 KB Output is correct
81 Correct 12 ms 1592 KB Output is correct
82 Correct 13 ms 1844 KB Output is correct
83 Correct 44 ms 3012 KB Output is correct
84 Correct 42 ms 3060 KB Output is correct
85 Correct 38 ms 2860 KB Output is correct
86 Correct 44 ms 3000 KB Output is correct
87 Correct 41 ms 3036 KB Output is correct
88 Correct 33 ms 2888 KB Output is correct
89 Correct 59 ms 3716 KB Output is correct
90 Correct 65 ms 5304 KB Output is correct
91 Correct 54 ms 3612 KB Output is correct
92 Correct 55 ms 3792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 9 ms 1144 KB Output is correct
3 Correct 8 ms 1080 KB Output is correct
4 Correct 9 ms 1140 KB Output is correct
5 Correct 9 ms 1232 KB Output is correct
6 Correct 9 ms 1152 KB Output is correct
7 Correct 8 ms 1060 KB Output is correct
8 Correct 7 ms 960 KB Output is correct
9 Correct 9 ms 964 KB Output is correct
10 Correct 7 ms 968 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 8 ms 1116 KB Output is correct
13 Correct 8 ms 1080 KB Output is correct
14 Correct 9 ms 1140 KB Output is correct
15 Correct 9 ms 1232 KB Output is correct
16 Correct 8 ms 1152 KB Output is correct
17 Correct 8 ms 1060 KB Output is correct
18 Correct 7 ms 960 KB Output is correct
19 Correct 9 ms 968 KB Output is correct
20 Correct 7 ms 968 KB Output is correct
21 Correct 40 ms 2876 KB Output is correct
22 Correct 33 ms 3144 KB Output is correct
23 Correct 42 ms 3008 KB Output is correct
24 Correct 39 ms 2988 KB Output is correct
25 Correct 38 ms 3060 KB Output is correct
26 Correct 45 ms 3256 KB Output is correct
27 Correct 42 ms 3032 KB Output is correct
28 Correct 34 ms 3140 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 8 ms 1152 KB Output is correct
31 Correct 8 ms 1136 KB Output is correct
32 Correct 9 ms 1136 KB Output is correct
33 Correct 9 ms 1160 KB Output is correct
34 Correct 8 ms 1152 KB Output is correct
35 Correct 8 ms 1140 KB Output is correct
36 Correct 7 ms 956 KB Output is correct
37 Correct 7 ms 968 KB Output is correct
38 Correct 7 ms 968 KB Output is correct
39 Correct 34 ms 2876 KB Output is correct
40 Correct 34 ms 2888 KB Output is correct
41 Correct 44 ms 3012 KB Output is correct
42 Correct 40 ms 3056 KB Output is correct
43 Correct 38 ms 3060 KB Output is correct
44 Correct 43 ms 3056 KB Output is correct
45 Correct 43 ms 3032 KB Output is correct
46 Correct 32 ms 2888 KB Output is correct
47 Correct 275 ms 12080 KB Output is correct
48 Correct 267 ms 12136 KB Output is correct
49 Correct 318 ms 11692 KB Output is correct
50 Correct 268 ms 10716 KB Output is correct
51 Correct 363 ms 12904 KB Output is correct
52 Correct 374 ms 13724 KB Output is correct
53 Correct 340 ms 12324 KB Output is correct
54 Correct 268 ms 12060 KB Output is correct
# 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 1 ms 504 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 51 ms 3408 KB Output is correct
7 Correct 43 ms 3052 KB Output is correct
8 Correct 50 ms 3404 KB Output is correct
9 Correct 60 ms 5304 KB Output is correct
10 Correct 35 ms 2876 KB Output is correct
11 Correct 34 ms 2888 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 3 ms 576 KB Output is correct
17 Correct 49 ms 3412 KB Output is correct
18 Correct 40 ms 2924 KB Output is correct
19 Correct 50 ms 3408 KB Output is correct
20 Correct 61 ms 5316 KB Output is correct
21 Correct 34 ms 2876 KB Output is correct
22 Correct 34 ms 2892 KB Output is correct
23 Correct 23 ms 996 KB Output is correct
24 Correct 479 ms 21316 KB Output is correct
25 Correct 368 ms 12888 KB Output is correct
26 Correct 526 ms 21560 KB Output is correct
27 Correct 522 ms 22400 KB Output is correct
28 Correct 272 ms 12016 KB Output is correct
29 Correct 280 ms 12044 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 9 ms 1144 KB Output is correct
32 Correct 8 ms 1080 KB Output is correct
33 Correct 9 ms 1140 KB Output is correct
34 Correct 9 ms 1232 KB Output is correct
35 Correct 9 ms 1152 KB Output is correct
36 Correct 8 ms 1060 KB Output is correct
37 Correct 7 ms 960 KB Output is correct
38 Correct 9 ms 964 KB Output is correct
39 Correct 7 ms 968 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 9 ms 1404 KB Output is correct
45 Correct 8 ms 1080 KB Output is correct
46 Correct 9 ms 1140 KB Output is correct
47 Correct 11 ms 1232 KB Output is correct
48 Correct 8 ms 1152 KB Output is correct
49 Correct 8 ms 1192 KB Output is correct
50 Correct 7 ms 1084 KB Output is correct
51 Correct 9 ms 968 KB Output is correct
52 Correct 7 ms 968 KB Output is correct
53 Correct 12 ms 1840 KB Output is correct
54 Correct 9 ms 1124 KB Output is correct
55 Correct 15 ms 1836 KB Output is correct
56 Correct 13 ms 1592 KB Output is correct
57 Correct 12 ms 1596 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 8 ms 1116 KB Output is correct
60 Correct 8 ms 1080 KB Output is correct
61 Correct 9 ms 1140 KB Output is correct
62 Correct 9 ms 1232 KB Output is correct
63 Correct 8 ms 1152 KB Output is correct
64 Correct 8 ms 1060 KB Output is correct
65 Correct 7 ms 960 KB Output is correct
66 Correct 9 ms 968 KB Output is correct
67 Correct 7 ms 968 KB Output is correct
68 Correct 40 ms 2876 KB Output is correct
69 Correct 33 ms 3144 KB Output is correct
70 Correct 42 ms 3008 KB Output is correct
71 Correct 39 ms 2988 KB Output is correct
72 Correct 38 ms 3060 KB Output is correct
73 Correct 45 ms 3256 KB Output is correct
74 Correct 42 ms 3032 KB Output is correct
75 Correct 34 ms 3140 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 1 ms 348 KB Output is correct
80 Correct 3 ms 348 KB Output is correct
81 Correct 49 ms 3456 KB Output is correct
82 Correct 40 ms 3048 KB Output is correct
83 Correct 53 ms 3668 KB Output is correct
84 Correct 61 ms 5300 KB Output is correct
85 Correct 35 ms 2876 KB Output is correct
86 Correct 34 ms 2892 KB Output is correct
87 Correct 9 ms 1152 KB Output is correct
88 Correct 8 ms 1080 KB Output is correct
89 Correct 9 ms 1140 KB Output is correct
90 Correct 9 ms 1232 KB Output is correct
91 Correct 8 ms 1152 KB Output is correct
92 Correct 8 ms 1060 KB Output is correct
93 Correct 7 ms 960 KB Output is correct
94 Correct 7 ms 964 KB Output is correct
95 Correct 7 ms 968 KB Output is correct
96 Correct 12 ms 1588 KB Output is correct
97 Correct 9 ms 1124 KB Output is correct
98 Correct 13 ms 1620 KB Output is correct
99 Correct 12 ms 1592 KB Output is correct
100 Correct 13 ms 1844 KB Output is correct
101 Correct 44 ms 3012 KB Output is correct
102 Correct 42 ms 3060 KB Output is correct
103 Correct 38 ms 2860 KB Output is correct
104 Correct 44 ms 3000 KB Output is correct
105 Correct 41 ms 3036 KB Output is correct
106 Correct 33 ms 2888 KB Output is correct
107 Correct 59 ms 3716 KB Output is correct
108 Correct 65 ms 5304 KB Output is correct
109 Correct 54 ms 3612 KB Output is correct
110 Correct 55 ms 3792 KB Output is correct
111 Correct 1 ms 344 KB Output is correct
112 Correct 8 ms 1152 KB Output is correct
113 Correct 8 ms 1136 KB Output is correct
114 Correct 9 ms 1136 KB Output is correct
115 Correct 9 ms 1160 KB Output is correct
116 Correct 8 ms 1152 KB Output is correct
117 Correct 8 ms 1140 KB Output is correct
118 Correct 7 ms 956 KB Output is correct
119 Correct 7 ms 968 KB Output is correct
120 Correct 7 ms 968 KB Output is correct
121 Correct 34 ms 2876 KB Output is correct
122 Correct 34 ms 2888 KB Output is correct
123 Correct 44 ms 3012 KB Output is correct
124 Correct 40 ms 3056 KB Output is correct
125 Correct 38 ms 3060 KB Output is correct
126 Correct 43 ms 3056 KB Output is correct
127 Correct 43 ms 3032 KB Output is correct
128 Correct 32 ms 2888 KB Output is correct
129 Correct 275 ms 12080 KB Output is correct
130 Correct 267 ms 12136 KB Output is correct
131 Correct 318 ms 11692 KB Output is correct
132 Correct 268 ms 10716 KB Output is correct
133 Correct 363 ms 12904 KB Output is correct
134 Correct 374 ms 13724 KB Output is correct
135 Correct 340 ms 12324 KB Output is correct
136 Correct 268 ms 12060 KB Output is correct
137 Correct 0 ms 344 KB Output is correct
138 Correct 0 ms 348 KB Output is correct
139 Correct 0 ms 348 KB Output is correct
140 Correct 1 ms 344 KB Output is correct
141 Correct 3 ms 348 KB Output is correct
142 Correct 49 ms 3372 KB Output is correct
143 Correct 41 ms 3048 KB Output is correct
144 Correct 49 ms 3400 KB Output is correct
145 Correct 60 ms 5308 KB Output is correct
146 Correct 35 ms 2876 KB Output is correct
147 Correct 33 ms 2888 KB Output is correct
148 Correct 23 ms 860 KB Output is correct
149 Correct 481 ms 22364 KB Output is correct
150 Correct 368 ms 13664 KB Output is correct
151 Correct 521 ms 21616 KB Output is correct
152 Correct 522 ms 21848 KB Output is correct
153 Correct 271 ms 12340 KB Output is correct
154 Correct 269 ms 11020 KB Output is correct
155 Correct 8 ms 1152 KB Output is correct
156 Correct 8 ms 1076 KB Output is correct
157 Correct 9 ms 1140 KB Output is correct
158 Correct 9 ms 1232 KB Output is correct
159 Correct 8 ms 1152 KB Output is correct
160 Correct 8 ms 1060 KB Output is correct
161 Correct 7 ms 960 KB Output is correct
162 Correct 7 ms 968 KB Output is correct
163 Correct 7 ms 968 KB Output is correct
164 Correct 42 ms 3036 KB Output is correct
165 Correct 40 ms 3060 KB Output is correct
166 Correct 38 ms 3060 KB Output is correct
167 Correct 44 ms 3256 KB Output is correct
168 Correct 41 ms 2940 KB Output is correct
169 Correct 33 ms 2888 KB Output is correct
170 Correct 12 ms 1584 KB Output is correct
171 Correct 9 ms 1124 KB Output is correct
172 Correct 13 ms 1576 KB Output is correct
173 Correct 12 ms 1592 KB Output is correct
174 Correct 12 ms 1588 KB Output is correct
175 Correct 56 ms 3564 KB Output is correct
176 Correct 60 ms 5308 KB Output is correct
177 Correct 54 ms 3356 KB Output is correct
178 Correct 56 ms 3588 KB Output is correct
179 Correct 307 ms 11692 KB Output is correct
180 Correct 269 ms 12364 KB Output is correct
181 Correct 364 ms 13024 KB Output is correct
182 Correct 366 ms 13292 KB Output is correct
183 Correct 338 ms 12828 KB Output is correct
184 Correct 259 ms 10272 KB Output is correct
185 Correct 438 ms 15184 KB Output is correct
186 Correct 528 ms 22892 KB Output is correct
187 Correct 477 ms 21776 KB Output is correct
188 Correct 480 ms 20420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 9 ms 1144 KB Output is correct
3 Correct 8 ms 1080 KB Output is correct
4 Correct 9 ms 1140 KB Output is correct
5 Correct 9 ms 1232 KB Output is correct
6 Correct 9 ms 1152 KB Output is correct
7 Correct 8 ms 1060 KB Output is correct
8 Correct 7 ms 960 KB Output is correct
9 Correct 9 ms 964 KB Output is correct
10 Correct 7 ms 968 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 8 ms 1116 KB Output is correct
13 Correct 8 ms 1080 KB Output is correct
14 Correct 9 ms 1140 KB Output is correct
15 Correct 9 ms 1232 KB Output is correct
16 Correct 8 ms 1152 KB Output is correct
17 Correct 8 ms 1060 KB Output is correct
18 Correct 7 ms 960 KB Output is correct
19 Correct 9 ms 968 KB Output is correct
20 Correct 7 ms 968 KB Output is correct
21 Correct 40 ms 2876 KB Output is correct
22 Correct 33 ms 3144 KB Output is correct
23 Correct 42 ms 3008 KB Output is correct
24 Correct 39 ms 2988 KB Output is correct
25 Correct 38 ms 3060 KB Output is correct
26 Correct 45 ms 3256 KB Output is correct
27 Correct 42 ms 3032 KB Output is correct
28 Correct 34 ms 3140 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 8 ms 1152 KB Output is correct
31 Correct 8 ms 1136 KB Output is correct
32 Correct 9 ms 1136 KB Output is correct
33 Correct 9 ms 1160 KB Output is correct
34 Correct 8 ms 1152 KB Output is correct
35 Correct 8 ms 1140 KB Output is correct
36 Correct 7 ms 956 KB Output is correct
37 Correct 7 ms 968 KB Output is correct
38 Correct 7 ms 968 KB Output is correct
39 Correct 34 ms 2876 KB Output is correct
40 Correct 34 ms 2888 KB Output is correct
41 Correct 44 ms 3012 KB Output is correct
42 Correct 40 ms 3056 KB Output is correct
43 Correct 38 ms 3060 KB Output is correct
44 Correct 43 ms 3056 KB Output is correct
45 Correct 43 ms 3032 KB Output is correct
46 Correct 32 ms 2888 KB Output is correct
47 Correct 275 ms 12080 KB Output is correct
48 Correct 267 ms 12136 KB Output is correct
49 Correct 318 ms 11692 KB Output is correct
50 Correct 268 ms 10716 KB Output is correct
51 Correct 363 ms 12904 KB Output is correct
52 Correct 374 ms 13724 KB Output is correct
53 Correct 340 ms 12324 KB Output is correct
54 Correct 268 ms 12060 KB Output is correct
55 Correct 1 ms 344 KB Output is correct
56 Correct 8 ms 1152 KB Output is correct
57 Correct 8 ms 1076 KB Output is correct
58 Correct 9 ms 1140 KB Output is correct
59 Correct 9 ms 1232 KB Output is correct
60 Correct 8 ms 1148 KB Output is correct
61 Correct 8 ms 1060 KB Output is correct
62 Correct 7 ms 1084 KB Output is correct
63 Correct 7 ms 968 KB Output is correct
64 Correct 7 ms 968 KB Output is correct
65 Correct 34 ms 2876 KB Output is correct
66 Correct 33 ms 2892 KB Output is correct
67 Correct 42 ms 3200 KB Output is correct
68 Correct 42 ms 3060 KB Output is correct
69 Correct 38 ms 3060 KB Output is correct
70 Correct 44 ms 3256 KB Output is correct
71 Correct 41 ms 3052 KB Output is correct
72 Correct 36 ms 2884 KB Output is correct
73 Correct 270 ms 11156 KB Output is correct
74 Correct 269 ms 11020 KB Output is correct
75 Correct 313 ms 11688 KB Output is correct
76 Correct 281 ms 11740 KB Output is correct
77 Correct 364 ms 13280 KB Output is correct
78 Correct 364 ms 13904 KB Output is correct
79 Correct 336 ms 12320 KB Output is correct
80 Correct 276 ms 12064 KB Output is correct
81 Execution timed out 5061 ms 100260 KB Time limit exceeded
82 Halted 0 ms 0 KB -
# 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 1 ms 504 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 51 ms 3408 KB Output is correct
7 Correct 43 ms 3052 KB Output is correct
8 Correct 50 ms 3404 KB Output is correct
9 Correct 60 ms 5304 KB Output is correct
10 Correct 35 ms 2876 KB Output is correct
11 Correct 34 ms 2888 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 3 ms 576 KB Output is correct
17 Correct 49 ms 3412 KB Output is correct
18 Correct 40 ms 2924 KB Output is correct
19 Correct 50 ms 3408 KB Output is correct
20 Correct 61 ms 5316 KB Output is correct
21 Correct 34 ms 2876 KB Output is correct
22 Correct 34 ms 2892 KB Output is correct
23 Correct 23 ms 996 KB Output is correct
24 Correct 479 ms 21316 KB Output is correct
25 Correct 368 ms 12888 KB Output is correct
26 Correct 526 ms 21560 KB Output is correct
27 Correct 522 ms 22400 KB Output is correct
28 Correct 272 ms 12016 KB Output is correct
29 Correct 280 ms 12044 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 9 ms 1144 KB Output is correct
32 Correct 8 ms 1080 KB Output is correct
33 Correct 9 ms 1140 KB Output is correct
34 Correct 9 ms 1232 KB Output is correct
35 Correct 9 ms 1152 KB Output is correct
36 Correct 8 ms 1060 KB Output is correct
37 Correct 7 ms 960 KB Output is correct
38 Correct 9 ms 964 KB Output is correct
39 Correct 7 ms 968 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 9 ms 1404 KB Output is correct
45 Correct 8 ms 1080 KB Output is correct
46 Correct 9 ms 1140 KB Output is correct
47 Correct 11 ms 1232 KB Output is correct
48 Correct 8 ms 1152 KB Output is correct
49 Correct 8 ms 1192 KB Output is correct
50 Correct 7 ms 1084 KB Output is correct
51 Correct 9 ms 968 KB Output is correct
52 Correct 7 ms 968 KB Output is correct
53 Correct 12 ms 1840 KB Output is correct
54 Correct 9 ms 1124 KB Output is correct
55 Correct 15 ms 1836 KB Output is correct
56 Correct 13 ms 1592 KB Output is correct
57 Correct 12 ms 1596 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 8 ms 1116 KB Output is correct
60 Correct 8 ms 1080 KB Output is correct
61 Correct 9 ms 1140 KB Output is correct
62 Correct 9 ms 1232 KB Output is correct
63 Correct 8 ms 1152 KB Output is correct
64 Correct 8 ms 1060 KB Output is correct
65 Correct 7 ms 960 KB Output is correct
66 Correct 9 ms 968 KB Output is correct
67 Correct 7 ms 968 KB Output is correct
68 Correct 40 ms 2876 KB Output is correct
69 Correct 33 ms 3144 KB Output is correct
70 Correct 42 ms 3008 KB Output is correct
71 Correct 39 ms 2988 KB Output is correct
72 Correct 38 ms 3060 KB Output is correct
73 Correct 45 ms 3256 KB Output is correct
74 Correct 42 ms 3032 KB Output is correct
75 Correct 34 ms 3140 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 1 ms 348 KB Output is correct
80 Correct 3 ms 348 KB Output is correct
81 Correct 49 ms 3456 KB Output is correct
82 Correct 40 ms 3048 KB Output is correct
83 Correct 53 ms 3668 KB Output is correct
84 Correct 61 ms 5300 KB Output is correct
85 Correct 35 ms 2876 KB Output is correct
86 Correct 34 ms 2892 KB Output is correct
87 Correct 9 ms 1152 KB Output is correct
88 Correct 8 ms 1080 KB Output is correct
89 Correct 9 ms 1140 KB Output is correct
90 Correct 9 ms 1232 KB Output is correct
91 Correct 8 ms 1152 KB Output is correct
92 Correct 8 ms 1060 KB Output is correct
93 Correct 7 ms 960 KB Output is correct
94 Correct 7 ms 964 KB Output is correct
95 Correct 7 ms 968 KB Output is correct
96 Correct 12 ms 1588 KB Output is correct
97 Correct 9 ms 1124 KB Output is correct
98 Correct 13 ms 1620 KB Output is correct
99 Correct 12 ms 1592 KB Output is correct
100 Correct 13 ms 1844 KB Output is correct
101 Correct 44 ms 3012 KB Output is correct
102 Correct 42 ms 3060 KB Output is correct
103 Correct 38 ms 2860 KB Output is correct
104 Correct 44 ms 3000 KB Output is correct
105 Correct 41 ms 3036 KB Output is correct
106 Correct 33 ms 2888 KB Output is correct
107 Correct 59 ms 3716 KB Output is correct
108 Correct 65 ms 5304 KB Output is correct
109 Correct 54 ms 3612 KB Output is correct
110 Correct 55 ms 3792 KB Output is correct
111 Correct 1 ms 344 KB Output is correct
112 Correct 8 ms 1152 KB Output is correct
113 Correct 8 ms 1136 KB Output is correct
114 Correct 9 ms 1136 KB Output is correct
115 Correct 9 ms 1160 KB Output is correct
116 Correct 8 ms 1152 KB Output is correct
117 Correct 8 ms 1140 KB Output is correct
118 Correct 7 ms 956 KB Output is correct
119 Correct 7 ms 968 KB Output is correct
120 Correct 7 ms 968 KB Output is correct
121 Correct 34 ms 2876 KB Output is correct
122 Correct 34 ms 2888 KB Output is correct
123 Correct 44 ms 3012 KB Output is correct
124 Correct 40 ms 3056 KB Output is correct
125 Correct 38 ms 3060 KB Output is correct
126 Correct 43 ms 3056 KB Output is correct
127 Correct 43 ms 3032 KB Output is correct
128 Correct 32 ms 2888 KB Output is correct
129 Correct 275 ms 12080 KB Output is correct
130 Correct 267 ms 12136 KB Output is correct
131 Correct 318 ms 11692 KB Output is correct
132 Correct 268 ms 10716 KB Output is correct
133 Correct 363 ms 12904 KB Output is correct
134 Correct 374 ms 13724 KB Output is correct
135 Correct 340 ms 12324 KB Output is correct
136 Correct 268 ms 12060 KB Output is correct
137 Correct 0 ms 344 KB Output is correct
138 Correct 0 ms 348 KB Output is correct
139 Correct 0 ms 348 KB Output is correct
140 Correct 1 ms 344 KB Output is correct
141 Correct 3 ms 348 KB Output is correct
142 Correct 49 ms 3372 KB Output is correct
143 Correct 41 ms 3048 KB Output is correct
144 Correct 49 ms 3400 KB Output is correct
145 Correct 60 ms 5308 KB Output is correct
146 Correct 35 ms 2876 KB Output is correct
147 Correct 33 ms 2888 KB Output is correct
148 Correct 23 ms 860 KB Output is correct
149 Correct 481 ms 22364 KB Output is correct
150 Correct 368 ms 13664 KB Output is correct
151 Correct 521 ms 21616 KB Output is correct
152 Correct 522 ms 21848 KB Output is correct
153 Correct 271 ms 12340 KB Output is correct
154 Correct 269 ms 11020 KB Output is correct
155 Correct 8 ms 1152 KB Output is correct
156 Correct 8 ms 1076 KB Output is correct
157 Correct 9 ms 1140 KB Output is correct
158 Correct 9 ms 1232 KB Output is correct
159 Correct 8 ms 1152 KB Output is correct
160 Correct 8 ms 1060 KB Output is correct
161 Correct 7 ms 960 KB Output is correct
162 Correct 7 ms 968 KB Output is correct
163 Correct 7 ms 968 KB Output is correct
164 Correct 42 ms 3036 KB Output is correct
165 Correct 40 ms 3060 KB Output is correct
166 Correct 38 ms 3060 KB Output is correct
167 Correct 44 ms 3256 KB Output is correct
168 Correct 41 ms 2940 KB Output is correct
169 Correct 33 ms 2888 KB Output is correct
170 Correct 12 ms 1584 KB Output is correct
171 Correct 9 ms 1124 KB Output is correct
172 Correct 13 ms 1576 KB Output is correct
173 Correct 12 ms 1592 KB Output is correct
174 Correct 12 ms 1588 KB Output is correct
175 Correct 56 ms 3564 KB Output is correct
176 Correct 60 ms 5308 KB Output is correct
177 Correct 54 ms 3356 KB Output is correct
178 Correct 56 ms 3588 KB Output is correct
179 Correct 307 ms 11692 KB Output is correct
180 Correct 269 ms 12364 KB Output is correct
181 Correct 364 ms 13024 KB Output is correct
182 Correct 366 ms 13292 KB Output is correct
183 Correct 338 ms 12828 KB Output is correct
184 Correct 259 ms 10272 KB Output is correct
185 Correct 438 ms 15184 KB Output is correct
186 Correct 528 ms 22892 KB Output is correct
187 Correct 477 ms 21776 KB Output is correct
188 Correct 480 ms 20420 KB Output is correct
189 Correct 1 ms 344 KB Output is correct
190 Correct 8 ms 1152 KB Output is correct
191 Correct 8 ms 1076 KB Output is correct
192 Correct 9 ms 1140 KB Output is correct
193 Correct 9 ms 1232 KB Output is correct
194 Correct 8 ms 1148 KB Output is correct
195 Correct 8 ms 1060 KB Output is correct
196 Correct 7 ms 1084 KB Output is correct
197 Correct 7 ms 968 KB Output is correct
198 Correct 7 ms 968 KB Output is correct
199 Correct 34 ms 2876 KB Output is correct
200 Correct 33 ms 2892 KB Output is correct
201 Correct 42 ms 3200 KB Output is correct
202 Correct 42 ms 3060 KB Output is correct
203 Correct 38 ms 3060 KB Output is correct
204 Correct 44 ms 3256 KB Output is correct
205 Correct 41 ms 3052 KB Output is correct
206 Correct 36 ms 2884 KB Output is correct
207 Correct 270 ms 11156 KB Output is correct
208 Correct 269 ms 11020 KB Output is correct
209 Correct 313 ms 11688 KB Output is correct
210 Correct 281 ms 11740 KB Output is correct
211 Correct 364 ms 13280 KB Output is correct
212 Correct 364 ms 13904 KB Output is correct
213 Correct 336 ms 12320 KB Output is correct
214 Correct 276 ms 12064 KB Output is correct
215 Execution timed out 5061 ms 100260 KB Time limit exceeded
216 Halted 0 ms 0 KB -