Submission #711408

# Submission time Handle Problem Language Result Execution time Memory
711408 2023-03-16T20:52:25 Z Johann Uplifting Excursion (BOI22_vault) C++14
70 / 100
5000 ms 284536 KB
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;
typedef vector<ll> vi;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

vi calcShifts(ll a)
{
    vi ans;
    ll i = 0;
    while ((1LL << i) <= a)
    {
        a -= (1LL << i);
        ans.push_back(i++);
    }
    while (i > 0)
        if ((1LL << --i) <= a)
            ans.push_back(i), a -= (1 << i);
    return ans;
}

vi dp;
ll center;
void calcDP(vi &A, ll M)
{
    ll an = accumulate(A.begin(), A.begin() + M, 0);
    ll ap = accumulate(A.begin() + M + 1, A.begin() + 2 * M + 1, 0);

    ll MAXSIZE = 2 * M * max(an, ap) + 2;
    center = MAXSIZE / 2;
    dp.assign(MAXSIZE, -1);
    dp[center] = A[M];
    for (int foo = 0; foo < 2; ++foo)
    {
        reverse(all(A)), reverse(all(dp));
        for (ll m = 1; m <= M; ++m)
        {
            ll maxNum = A[m + M];
            vi shifts = calcShifts(maxNum);
            for (int i : shifts)
            {
                ll amount = (1 << i);
                ll d = amount * m;
                for (int j = sz(dp) - 1; j >= d; --j)
                    dp[j] = max(dp[j], (dp[j - d] != -1) ? dp[j - d] + amount : -1);
            }
        }
    }
}

pii calcPref(vi &A, int M, ll L, ll &pref, ll &tmpans) // find last Prefix position { i, idx } with pref <= L, or { sz(A)-1 = 2 * M, A[2 * M] }
{
    int i = 0;
    tmpans = 0, pref = 0;
    for (; i < M; ++i)
        tmpans += A[i], pref += A[i] * (i - M);
    if (pref >= L)
        return {i, 0};
    while (i < sz(A) && pref + A[i] * (i - M) < L)
    {
        pref += A[i] * (i - M);
        tmpans += A[i];
        ++i;
    }
    if (i == sz(A))
        return {i - 1, A[i - 1]};

    ll delta = L - pref;
    assert(delta >= 0); // The expectation after the while loop is, that one is able to forfill this shit with the A[i] * (i - M) stuff
    ll l = delta / (i - M);
    pref += l * (i - M);
    tmpans += l;

    return {i, l};
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll M, L;
    cin >> M >> L;
    vi A(2 * M + 1);
    for (int i = 0; i < sz(A); ++i)
        cin >> A[i];

    vi B(sz(A), 0);
    ll dpMax = 0, dpMin = 0; // Obere Grenze und untere Grenze für das davon induzierte DP
    for (int i = 0; i < sz(B); ++i)
    {
        if (i == M)
        {
            B[i] = A[i];
            A[i] = 0;
            continue;
        }
        B[i] = min(M - 1, A[i]);
        A[i] -= B[i];
        dpMax = max(dpMax, dpMax + B[i] * (i - M));
        dpMin = min(dpMin, dpMin + B[i] * (i - M));
    }

    // Calc dp with normal stuff
    calcDP(B, M);

    ll li, lidx, pref, tmpans;
    tie(li, lidx) = calcPref(A, M, L - dpMax, pref, tmpans);

    ll ans = -1;
    ll i = li;
    ll idx = lidx;
    while (i < sz(A) && L - pref + center >= 0)
    {
        if (L - pref + center < sz(dp) && dp[L - pref + center] != -1)
            ans = max(ans, tmpans + dp[L - pref + center]);
        if (idx < A[i])
        {
            ++idx;
            ++tmpans;
            pref += i - M;
        }
        else
        {
            ++i;
            idx = 0;
        }
    }

    if (ans == -1)
        cout << "impossible\n";
    else
        cout << ans << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 80 ms 1236 KB Output is correct
6 Correct 85 ms 1364 KB Output is correct
7 Correct 18 ms 724 KB Output is correct
8 Correct 83 ms 1236 KB Output is correct
9 Correct 202 ms 2132 KB Output is correct
10 Correct 1 ms 280 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 80 ms 1236 KB Output is correct
6 Correct 85 ms 1364 KB Output is correct
7 Correct 18 ms 724 KB Output is correct
8 Correct 83 ms 1236 KB Output is correct
9 Correct 202 ms 2132 KB Output is correct
10 Correct 1 ms 280 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 79 ms 1236 KB Output is correct
17 Correct 91 ms 1364 KB Output is correct
18 Correct 18 ms 724 KB Output is correct
19 Correct 87 ms 1280 KB Output is correct
20 Correct 195 ms 2132 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1825 ms 8660 KB Output is correct
24 Correct 1731 ms 8276 KB Output is correct
25 Correct 230 ms 3136 KB Output is correct
26 Correct 4336 ms 15572 KB Output is correct
27 Correct 4245 ms 15424 KB Output is correct
28 Correct 2 ms 596 KB Output is correct
29 Correct 2 ms 572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 10 ms 596 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 11 ms 596 KB Output is correct
5 Correct 15 ms 724 KB Output is correct
6 Correct 5 ms 468 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 4 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 10 ms 596 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 11 ms 596 KB Output is correct
5 Correct 15 ms 724 KB Output is correct
6 Correct 5 ms 468 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 4 ms 468 KB Output is correct
11 Correct 1 ms 320 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 7 ms 596 KB Output is correct
16 Correct 1 ms 320 KB Output is correct
17 Correct 8 ms 596 KB Output is correct
18 Correct 12 ms 724 KB Output is correct
19 Correct 6 ms 468 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 3 ms 340 KB Output is correct
23 Correct 5 ms 468 KB Output is correct
24 Correct 18 ms 596 KB Output is correct
25 Correct 4 ms 468 KB Output is correct
26 Correct 27 ms 724 KB Output is correct
27 Correct 15 ms 596 KB Output is correct
28 Correct 18 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 10 ms 596 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 11 ms 596 KB Output is correct
5 Correct 15 ms 724 KB Output is correct
6 Correct 5 ms 468 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 4 ms 468 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 7 ms 596 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 9 ms 596 KB Output is correct
15 Correct 12 ms 724 KB Output is correct
16 Correct 6 ms 468 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 448 KB Output is correct
20 Correct 4 ms 468 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 316 KB Output is correct
23 Correct 51 ms 1492 KB Output is correct
24 Correct 12 ms 852 KB Output is correct
25 Correct 58 ms 1492 KB Output is correct
26 Correct 98 ms 2132 KB Output is correct
27 Correct 72 ms 1620 KB Output is correct
28 Correct 39 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 80 ms 1236 KB Output is correct
6 Correct 85 ms 1364 KB Output is correct
7 Correct 18 ms 724 KB Output is correct
8 Correct 83 ms 1236 KB Output is correct
9 Correct 202 ms 2132 KB Output is correct
10 Correct 1 ms 280 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 10 ms 596 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 11 ms 596 KB Output is correct
16 Correct 15 ms 724 KB Output is correct
17 Correct 5 ms 468 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 328 KB Output is correct
20 Correct 3 ms 340 KB Output is correct
21 Correct 4 ms 468 KB Output is correct
22 Correct 1 ms 320 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 7 ms 596 KB Output is correct
27 Correct 1 ms 320 KB Output is correct
28 Correct 8 ms 596 KB Output is correct
29 Correct 12 ms 724 KB Output is correct
30 Correct 6 ms 468 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 328 KB Output is correct
33 Correct 3 ms 340 KB Output is correct
34 Correct 5 ms 468 KB Output is correct
35 Correct 18 ms 596 KB Output is correct
36 Correct 4 ms 468 KB Output is correct
37 Correct 27 ms 724 KB Output is correct
38 Correct 15 ms 596 KB Output is correct
39 Correct 18 ms 596 KB Output is correct
40 Correct 1 ms 324 KB Output is correct
41 Correct 7 ms 596 KB Output is correct
42 Correct 1 ms 324 KB Output is correct
43 Correct 9 ms 596 KB Output is correct
44 Correct 12 ms 724 KB Output is correct
45 Correct 6 ms 468 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 2 ms 448 KB Output is correct
49 Correct 4 ms 468 KB Output is correct
50 Correct 1 ms 340 KB Output is correct
51 Correct 1 ms 316 KB Output is correct
52 Correct 51 ms 1492 KB Output is correct
53 Correct 12 ms 852 KB Output is correct
54 Correct 58 ms 1492 KB Output is correct
55 Correct 98 ms 2132 KB Output is correct
56 Correct 72 ms 1620 KB Output is correct
57 Correct 39 ms 1364 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 1 ms 284 KB Output is correct
60 Correct 0 ms 324 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 85 ms 1364 KB Output is correct
63 Correct 99 ms 1364 KB Output is correct
64 Correct 21 ms 724 KB Output is correct
65 Correct 88 ms 1236 KB Output is correct
66 Correct 197 ms 2112 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 340 KB Output is correct
69 Correct 7 ms 580 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 11 ms 596 KB Output is correct
72 Correct 12 ms 724 KB Output is correct
73 Correct 6 ms 448 KB Output is correct
74 Correct 1 ms 340 KB Output is correct
75 Correct 1 ms 328 KB Output is correct
76 Correct 2 ms 340 KB Output is correct
77 Correct 4 ms 468 KB Output is correct
78 Correct 14 ms 596 KB Output is correct
79 Correct 3 ms 468 KB Output is correct
80 Correct 23 ms 708 KB Output is correct
81 Correct 14 ms 596 KB Output is correct
82 Correct 18 ms 596 KB Output is correct
83 Correct 57 ms 1492 KB Output is correct
84 Correct 12 ms 836 KB Output is correct
85 Correct 51 ms 1492 KB Output is correct
86 Correct 99 ms 2132 KB Output is correct
87 Correct 64 ms 1620 KB Output is correct
88 Correct 42 ms 1364 KB Output is correct
89 Correct 113 ms 1476 KB Output is correct
90 Correct 184 ms 2132 KB Output is correct
91 Correct 100 ms 1492 KB Output is correct
92 Correct 134 ms 1748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 10 ms 596 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 11 ms 596 KB Output is correct
5 Correct 15 ms 724 KB Output is correct
6 Correct 5 ms 468 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 4 ms 468 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 7 ms 596 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 9 ms 596 KB Output is correct
15 Correct 12 ms 724 KB Output is correct
16 Correct 6 ms 468 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 448 KB Output is correct
20 Correct 4 ms 468 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 316 KB Output is correct
23 Correct 51 ms 1492 KB Output is correct
24 Correct 12 ms 852 KB Output is correct
25 Correct 58 ms 1492 KB Output is correct
26 Correct 98 ms 2132 KB Output is correct
27 Correct 72 ms 1620 KB Output is correct
28 Correct 39 ms 1364 KB Output is correct
29 Correct 1 ms 328 KB Output is correct
30 Correct 7 ms 664 KB Output is correct
31 Correct 1 ms 324 KB Output is correct
32 Correct 8 ms 596 KB Output is correct
33 Correct 11 ms 724 KB Output is correct
34 Correct 6 ms 468 KB Output is correct
35 Correct 0 ms 340 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 4 ms 452 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 52 ms 1492 KB Output is correct
42 Correct 13 ms 852 KB Output is correct
43 Correct 50 ms 1492 KB Output is correct
44 Correct 93 ms 2132 KB Output is correct
45 Correct 60 ms 1620 KB Output is correct
46 Correct 40 ms 1344 KB Output is correct
47 Correct 1 ms 596 KB Output is correct
48 Correct 2 ms 580 KB Output is correct
49 Correct 1192 ms 10196 KB Output is correct
50 Correct 185 ms 4564 KB Output is correct
51 Correct 1363 ms 11348 KB Output is correct
52 Correct 2088 ms 15572 KB Output is correct
53 Correct 1147 ms 10196 KB Output is correct
54 Correct 726 ms 8532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 80 ms 1236 KB Output is correct
6 Correct 85 ms 1364 KB Output is correct
7 Correct 18 ms 724 KB Output is correct
8 Correct 83 ms 1236 KB Output is correct
9 Correct 202 ms 2132 KB Output is correct
10 Correct 1 ms 280 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 79 ms 1236 KB Output is correct
17 Correct 91 ms 1364 KB Output is correct
18 Correct 18 ms 724 KB Output is correct
19 Correct 87 ms 1280 KB Output is correct
20 Correct 195 ms 2132 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1825 ms 8660 KB Output is correct
24 Correct 1731 ms 8276 KB Output is correct
25 Correct 230 ms 3136 KB Output is correct
26 Correct 4336 ms 15572 KB Output is correct
27 Correct 4245 ms 15424 KB Output is correct
28 Correct 2 ms 596 KB Output is correct
29 Correct 2 ms 572 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 10 ms 596 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 11 ms 596 KB Output is correct
34 Correct 15 ms 724 KB Output is correct
35 Correct 5 ms 468 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 328 KB Output is correct
38 Correct 3 ms 340 KB Output is correct
39 Correct 4 ms 468 KB Output is correct
40 Correct 1 ms 320 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 7 ms 596 KB Output is correct
45 Correct 1 ms 320 KB Output is correct
46 Correct 8 ms 596 KB Output is correct
47 Correct 12 ms 724 KB Output is correct
48 Correct 6 ms 468 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 1 ms 328 KB Output is correct
51 Correct 3 ms 340 KB Output is correct
52 Correct 5 ms 468 KB Output is correct
53 Correct 18 ms 596 KB Output is correct
54 Correct 4 ms 468 KB Output is correct
55 Correct 27 ms 724 KB Output is correct
56 Correct 15 ms 596 KB Output is correct
57 Correct 18 ms 596 KB Output is correct
58 Correct 1 ms 324 KB Output is correct
59 Correct 7 ms 596 KB Output is correct
60 Correct 1 ms 324 KB Output is correct
61 Correct 9 ms 596 KB Output is correct
62 Correct 12 ms 724 KB Output is correct
63 Correct 6 ms 468 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 2 ms 448 KB Output is correct
67 Correct 4 ms 468 KB Output is correct
68 Correct 1 ms 340 KB Output is correct
69 Correct 1 ms 316 KB Output is correct
70 Correct 51 ms 1492 KB Output is correct
71 Correct 12 ms 852 KB Output is correct
72 Correct 58 ms 1492 KB Output is correct
73 Correct 98 ms 2132 KB Output is correct
74 Correct 72 ms 1620 KB Output is correct
75 Correct 39 ms 1364 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 284 KB Output is correct
78 Correct 0 ms 324 KB Output is correct
79 Correct 1 ms 212 KB Output is correct
80 Correct 85 ms 1364 KB Output is correct
81 Correct 99 ms 1364 KB Output is correct
82 Correct 21 ms 724 KB Output is correct
83 Correct 88 ms 1236 KB Output is correct
84 Correct 197 ms 2112 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 1 ms 340 KB Output is correct
87 Correct 7 ms 580 KB Output is correct
88 Correct 1 ms 340 KB Output is correct
89 Correct 11 ms 596 KB Output is correct
90 Correct 12 ms 724 KB Output is correct
91 Correct 6 ms 448 KB Output is correct
92 Correct 1 ms 340 KB Output is correct
93 Correct 1 ms 328 KB Output is correct
94 Correct 2 ms 340 KB Output is correct
95 Correct 4 ms 468 KB Output is correct
96 Correct 14 ms 596 KB Output is correct
97 Correct 3 ms 468 KB Output is correct
98 Correct 23 ms 708 KB Output is correct
99 Correct 14 ms 596 KB Output is correct
100 Correct 18 ms 596 KB Output is correct
101 Correct 57 ms 1492 KB Output is correct
102 Correct 12 ms 836 KB Output is correct
103 Correct 51 ms 1492 KB Output is correct
104 Correct 99 ms 2132 KB Output is correct
105 Correct 64 ms 1620 KB Output is correct
106 Correct 42 ms 1364 KB Output is correct
107 Correct 113 ms 1476 KB Output is correct
108 Correct 184 ms 2132 KB Output is correct
109 Correct 100 ms 1492 KB Output is correct
110 Correct 134 ms 1748 KB Output is correct
111 Correct 1 ms 328 KB Output is correct
112 Correct 7 ms 664 KB Output is correct
113 Correct 1 ms 324 KB Output is correct
114 Correct 8 ms 596 KB Output is correct
115 Correct 11 ms 724 KB Output is correct
116 Correct 6 ms 468 KB Output is correct
117 Correct 0 ms 340 KB Output is correct
118 Correct 1 ms 316 KB Output is correct
119 Correct 2 ms 340 KB Output is correct
120 Correct 4 ms 452 KB Output is correct
121 Correct 1 ms 340 KB Output is correct
122 Correct 1 ms 340 KB Output is correct
123 Correct 52 ms 1492 KB Output is correct
124 Correct 13 ms 852 KB Output is correct
125 Correct 50 ms 1492 KB Output is correct
126 Correct 93 ms 2132 KB Output is correct
127 Correct 60 ms 1620 KB Output is correct
128 Correct 40 ms 1344 KB Output is correct
129 Correct 1 ms 596 KB Output is correct
130 Correct 2 ms 580 KB Output is correct
131 Correct 1192 ms 10196 KB Output is correct
132 Correct 185 ms 4564 KB Output is correct
133 Correct 1363 ms 11348 KB Output is correct
134 Correct 2088 ms 15572 KB Output is correct
135 Correct 1147 ms 10196 KB Output is correct
136 Correct 726 ms 8532 KB Output is correct
137 Correct 1 ms 324 KB Output is correct
138 Correct 0 ms 324 KB Output is correct
139 Correct 1 ms 212 KB Output is correct
140 Correct 1 ms 340 KB Output is correct
141 Correct 105 ms 1364 KB Output is correct
142 Correct 84 ms 1364 KB Output is correct
143 Correct 18 ms 724 KB Output is correct
144 Correct 76 ms 1236 KB Output is correct
145 Correct 179 ms 2132 KB Output is correct
146 Correct 1 ms 340 KB Output is correct
147 Correct 1 ms 340 KB Output is correct
148 Correct 1780 ms 8660 KB Output is correct
149 Correct 1686 ms 8276 KB Output is correct
150 Correct 249 ms 3156 KB Output is correct
151 Correct 4173 ms 15492 KB Output is correct
152 Correct 4131 ms 15444 KB Output is correct
153 Correct 1 ms 596 KB Output is correct
154 Correct 2 ms 580 KB Output is correct
155 Correct 8 ms 596 KB Output is correct
156 Correct 1 ms 324 KB Output is correct
157 Correct 9 ms 588 KB Output is correct
158 Correct 12 ms 724 KB Output is correct
159 Correct 6 ms 468 KB Output is correct
160 Correct 1 ms 340 KB Output is correct
161 Correct 1 ms 328 KB Output is correct
162 Correct 2 ms 340 KB Output is correct
163 Correct 4 ms 468 KB Output is correct
164 Correct 54 ms 1492 KB Output is correct
165 Correct 15 ms 852 KB Output is correct
166 Correct 54 ms 1492 KB Output is correct
167 Correct 94 ms 2132 KB Output is correct
168 Correct 60 ms 1620 KB Output is correct
169 Correct 38 ms 1364 KB Output is correct
170 Correct 14 ms 596 KB Output is correct
171 Correct 3 ms 468 KB Output is correct
172 Correct 23 ms 724 KB Output is correct
173 Correct 12 ms 580 KB Output is correct
174 Correct 17 ms 576 KB Output is correct
175 Correct 106 ms 1492 KB Output is correct
176 Correct 194 ms 2120 KB Output is correct
177 Correct 107 ms 1604 KB Output is correct
178 Correct 122 ms 1748 KB Output is correct
179 Correct 1146 ms 10196 KB Output is correct
180 Correct 191 ms 4564 KB Output is correct
181 Correct 1384 ms 11348 KB Output is correct
182 Correct 2095 ms 15572 KB Output is correct
183 Correct 1118 ms 10184 KB Output is correct
184 Correct 768 ms 8532 KB Output is correct
185 Correct 2306 ms 10196 KB Output is correct
186 Correct 4048 ms 15572 KB Output is correct
187 Incorrect 2288 ms 10324 KB Output isn't correct
188 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 10 ms 596 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 11 ms 596 KB Output is correct
5 Correct 15 ms 724 KB Output is correct
6 Correct 5 ms 468 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 4 ms 468 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 7 ms 596 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 9 ms 596 KB Output is correct
15 Correct 12 ms 724 KB Output is correct
16 Correct 6 ms 468 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 448 KB Output is correct
20 Correct 4 ms 468 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 316 KB Output is correct
23 Correct 51 ms 1492 KB Output is correct
24 Correct 12 ms 852 KB Output is correct
25 Correct 58 ms 1492 KB Output is correct
26 Correct 98 ms 2132 KB Output is correct
27 Correct 72 ms 1620 KB Output is correct
28 Correct 39 ms 1364 KB Output is correct
29 Correct 1 ms 328 KB Output is correct
30 Correct 7 ms 664 KB Output is correct
31 Correct 1 ms 324 KB Output is correct
32 Correct 8 ms 596 KB Output is correct
33 Correct 11 ms 724 KB Output is correct
34 Correct 6 ms 468 KB Output is correct
35 Correct 0 ms 340 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 4 ms 452 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 52 ms 1492 KB Output is correct
42 Correct 13 ms 852 KB Output is correct
43 Correct 50 ms 1492 KB Output is correct
44 Correct 93 ms 2132 KB Output is correct
45 Correct 60 ms 1620 KB Output is correct
46 Correct 40 ms 1344 KB Output is correct
47 Correct 1 ms 596 KB Output is correct
48 Correct 2 ms 580 KB Output is correct
49 Correct 1192 ms 10196 KB Output is correct
50 Correct 185 ms 4564 KB Output is correct
51 Correct 1363 ms 11348 KB Output is correct
52 Correct 2088 ms 15572 KB Output is correct
53 Correct 1147 ms 10196 KB Output is correct
54 Correct 726 ms 8532 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 10 ms 596 KB Output is correct
57 Correct 2 ms 340 KB Output is correct
58 Correct 9 ms 596 KB Output is correct
59 Correct 12 ms 724 KB Output is correct
60 Correct 6 ms 468 KB Output is correct
61 Correct 1 ms 324 KB Output is correct
62 Correct 1 ms 320 KB Output is correct
63 Correct 2 ms 456 KB Output is correct
64 Correct 4 ms 468 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 57 ms 1492 KB Output is correct
68 Correct 13 ms 836 KB Output is correct
69 Correct 68 ms 1492 KB Output is correct
70 Correct 98 ms 2132 KB Output is correct
71 Correct 60 ms 1656 KB Output is correct
72 Correct 38 ms 1364 KB Output is correct
73 Correct 2 ms 580 KB Output is correct
74 Correct 1 ms 596 KB Output is correct
75 Correct 1131 ms 10196 KB Output is correct
76 Correct 189 ms 4564 KB Output is correct
77 Correct 1381 ms 11332 KB Output is correct
78 Correct 2069 ms 15572 KB Output is correct
79 Correct 1140 ms 10196 KB Output is correct
80 Correct 748 ms 8532 KB Output is correct
81 Execution timed out 5028 ms 284536 KB Time limit exceeded
82 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 80 ms 1236 KB Output is correct
6 Correct 85 ms 1364 KB Output is correct
7 Correct 18 ms 724 KB Output is correct
8 Correct 83 ms 1236 KB Output is correct
9 Correct 202 ms 2132 KB Output is correct
10 Correct 1 ms 280 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 79 ms 1236 KB Output is correct
17 Correct 91 ms 1364 KB Output is correct
18 Correct 18 ms 724 KB Output is correct
19 Correct 87 ms 1280 KB Output is correct
20 Correct 195 ms 2132 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1825 ms 8660 KB Output is correct
24 Correct 1731 ms 8276 KB Output is correct
25 Correct 230 ms 3136 KB Output is correct
26 Correct 4336 ms 15572 KB Output is correct
27 Correct 4245 ms 15424 KB Output is correct
28 Correct 2 ms 596 KB Output is correct
29 Correct 2 ms 572 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 10 ms 596 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 11 ms 596 KB Output is correct
34 Correct 15 ms 724 KB Output is correct
35 Correct 5 ms 468 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 328 KB Output is correct
38 Correct 3 ms 340 KB Output is correct
39 Correct 4 ms 468 KB Output is correct
40 Correct 1 ms 320 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 7 ms 596 KB Output is correct
45 Correct 1 ms 320 KB Output is correct
46 Correct 8 ms 596 KB Output is correct
47 Correct 12 ms 724 KB Output is correct
48 Correct 6 ms 468 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 1 ms 328 KB Output is correct
51 Correct 3 ms 340 KB Output is correct
52 Correct 5 ms 468 KB Output is correct
53 Correct 18 ms 596 KB Output is correct
54 Correct 4 ms 468 KB Output is correct
55 Correct 27 ms 724 KB Output is correct
56 Correct 15 ms 596 KB Output is correct
57 Correct 18 ms 596 KB Output is correct
58 Correct 1 ms 324 KB Output is correct
59 Correct 7 ms 596 KB Output is correct
60 Correct 1 ms 324 KB Output is correct
61 Correct 9 ms 596 KB Output is correct
62 Correct 12 ms 724 KB Output is correct
63 Correct 6 ms 468 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 2 ms 448 KB Output is correct
67 Correct 4 ms 468 KB Output is correct
68 Correct 1 ms 340 KB Output is correct
69 Correct 1 ms 316 KB Output is correct
70 Correct 51 ms 1492 KB Output is correct
71 Correct 12 ms 852 KB Output is correct
72 Correct 58 ms 1492 KB Output is correct
73 Correct 98 ms 2132 KB Output is correct
74 Correct 72 ms 1620 KB Output is correct
75 Correct 39 ms 1364 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 284 KB Output is correct
78 Correct 0 ms 324 KB Output is correct
79 Correct 1 ms 212 KB Output is correct
80 Correct 85 ms 1364 KB Output is correct
81 Correct 99 ms 1364 KB Output is correct
82 Correct 21 ms 724 KB Output is correct
83 Correct 88 ms 1236 KB Output is correct
84 Correct 197 ms 2112 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 1 ms 340 KB Output is correct
87 Correct 7 ms 580 KB Output is correct
88 Correct 1 ms 340 KB Output is correct
89 Correct 11 ms 596 KB Output is correct
90 Correct 12 ms 724 KB Output is correct
91 Correct 6 ms 448 KB Output is correct
92 Correct 1 ms 340 KB Output is correct
93 Correct 1 ms 328 KB Output is correct
94 Correct 2 ms 340 KB Output is correct
95 Correct 4 ms 468 KB Output is correct
96 Correct 14 ms 596 KB Output is correct
97 Correct 3 ms 468 KB Output is correct
98 Correct 23 ms 708 KB Output is correct
99 Correct 14 ms 596 KB Output is correct
100 Correct 18 ms 596 KB Output is correct
101 Correct 57 ms 1492 KB Output is correct
102 Correct 12 ms 836 KB Output is correct
103 Correct 51 ms 1492 KB Output is correct
104 Correct 99 ms 2132 KB Output is correct
105 Correct 64 ms 1620 KB Output is correct
106 Correct 42 ms 1364 KB Output is correct
107 Correct 113 ms 1476 KB Output is correct
108 Correct 184 ms 2132 KB Output is correct
109 Correct 100 ms 1492 KB Output is correct
110 Correct 134 ms 1748 KB Output is correct
111 Correct 1 ms 328 KB Output is correct
112 Correct 7 ms 664 KB Output is correct
113 Correct 1 ms 324 KB Output is correct
114 Correct 8 ms 596 KB Output is correct
115 Correct 11 ms 724 KB Output is correct
116 Correct 6 ms 468 KB Output is correct
117 Correct 0 ms 340 KB Output is correct
118 Correct 1 ms 316 KB Output is correct
119 Correct 2 ms 340 KB Output is correct
120 Correct 4 ms 452 KB Output is correct
121 Correct 1 ms 340 KB Output is correct
122 Correct 1 ms 340 KB Output is correct
123 Correct 52 ms 1492 KB Output is correct
124 Correct 13 ms 852 KB Output is correct
125 Correct 50 ms 1492 KB Output is correct
126 Correct 93 ms 2132 KB Output is correct
127 Correct 60 ms 1620 KB Output is correct
128 Correct 40 ms 1344 KB Output is correct
129 Correct 1 ms 596 KB Output is correct
130 Correct 2 ms 580 KB Output is correct
131 Correct 1192 ms 10196 KB Output is correct
132 Correct 185 ms 4564 KB Output is correct
133 Correct 1363 ms 11348 KB Output is correct
134 Correct 2088 ms 15572 KB Output is correct
135 Correct 1147 ms 10196 KB Output is correct
136 Correct 726 ms 8532 KB Output is correct
137 Correct 1 ms 324 KB Output is correct
138 Correct 0 ms 324 KB Output is correct
139 Correct 1 ms 212 KB Output is correct
140 Correct 1 ms 340 KB Output is correct
141 Correct 105 ms 1364 KB Output is correct
142 Correct 84 ms 1364 KB Output is correct
143 Correct 18 ms 724 KB Output is correct
144 Correct 76 ms 1236 KB Output is correct
145 Correct 179 ms 2132 KB Output is correct
146 Correct 1 ms 340 KB Output is correct
147 Correct 1 ms 340 KB Output is correct
148 Correct 1780 ms 8660 KB Output is correct
149 Correct 1686 ms 8276 KB Output is correct
150 Correct 249 ms 3156 KB Output is correct
151 Correct 4173 ms 15492 KB Output is correct
152 Correct 4131 ms 15444 KB Output is correct
153 Correct 1 ms 596 KB Output is correct
154 Correct 2 ms 580 KB Output is correct
155 Correct 8 ms 596 KB Output is correct
156 Correct 1 ms 324 KB Output is correct
157 Correct 9 ms 588 KB Output is correct
158 Correct 12 ms 724 KB Output is correct
159 Correct 6 ms 468 KB Output is correct
160 Correct 1 ms 340 KB Output is correct
161 Correct 1 ms 328 KB Output is correct
162 Correct 2 ms 340 KB Output is correct
163 Correct 4 ms 468 KB Output is correct
164 Correct 54 ms 1492 KB Output is correct
165 Correct 15 ms 852 KB Output is correct
166 Correct 54 ms 1492 KB Output is correct
167 Correct 94 ms 2132 KB Output is correct
168 Correct 60 ms 1620 KB Output is correct
169 Correct 38 ms 1364 KB Output is correct
170 Correct 14 ms 596 KB Output is correct
171 Correct 3 ms 468 KB Output is correct
172 Correct 23 ms 724 KB Output is correct
173 Correct 12 ms 580 KB Output is correct
174 Correct 17 ms 576 KB Output is correct
175 Correct 106 ms 1492 KB Output is correct
176 Correct 194 ms 2120 KB Output is correct
177 Correct 107 ms 1604 KB Output is correct
178 Correct 122 ms 1748 KB Output is correct
179 Correct 1146 ms 10196 KB Output is correct
180 Correct 191 ms 4564 KB Output is correct
181 Correct 1384 ms 11348 KB Output is correct
182 Correct 2095 ms 15572 KB Output is correct
183 Correct 1118 ms 10184 KB Output is correct
184 Correct 768 ms 8532 KB Output is correct
185 Correct 2306 ms 10196 KB Output is correct
186 Correct 4048 ms 15572 KB Output is correct
187 Incorrect 2288 ms 10324 KB Output isn't correct
188 Halted 0 ms 0 KB -