Submission #944134

# Submission time Handle Problem Language Result Execution time Memory
944134 2024-03-12T08:52:29 Z LucaIlie Uplifting Excursion (BOI22_vault) C++17
100 / 100
3002 ms 3496 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_M = 300;
int MAX_S;
int MIN_S;
const long long INF = 1e18;
int m;
unordered_map<int, long long> taken, untaken;
long long dpCrt[2 * MAX_M * MAX_M + 1], dpPrv[2 * MAX_M * MAX_M + 1];

void add( int x, int k ) {
    swap( dpCrt, dpPrv );

    if ( x > 0 ) {
        for ( int r = 0; r < x; r++ ) {
            deque<pair<int, int>> d;
            for ( int i = 0, s = MIN_S + r; s <= MAX_S; i++, s += x ) {
                if ( !d.empty() && i - d.front().second > k )
                    d.pop_front();
                while ( !d.empty() && dpPrv[s - MIN_S] - i >= dpPrv[d.back().first - MIN_S] - d.back().second )
                    d.pop_back();
                d.push_back( { s, i } );
                dpCrt[s - MIN_S] = dpPrv[d.front().first - MIN_S] + i - d.front().second;
            }
        }
    } else {
        x = -x;
        for ( int r = 0; r < x; r++ ) {
            deque<pair<int, int>> d;
            for ( int i = 0, s = MAX_S - r; s >= MIN_S; i++, s -= x ) {
                if ( !d.empty() && i - d.front().second > k )
                    d.pop_front();
                while ( !d.empty() && dpPrv[s - MIN_S] - i >= dpPrv[d.back().first - MIN_S] - d.back().second )
                    d.pop_back();
                d.push_back( { s, i } );
                dpCrt[s - MIN_S] = dpPrv[d.front().first - MIN_S] + i - d.front().second;
            }
        }
    }

    for ( int s = MIN_S; s <= MAX_S; s++ )
        dpCrt[s - MIN_S] = (dpCrt[s - MIN_S] <= -INF + m ? -INF : dpCrt[s - MIN_S]);
}

void substract( int x, int k ) {
    swap( dpCrt, dpPrv );

    if ( x < 0 ) {
        x = -x;
        for ( int r = 0; r < x; r++ ) {
            deque<pair<int, int>> d;
            for ( int i = 0, s = MIN_S + r; s <= MAX_S; i++, s += x ) {
                if ( !d.empty() && i - d.front().second > k )
                    d.pop_front();
                while ( !d.empty() && dpPrv[s - MIN_S] + i >= dpPrv[d.back().first - MIN_S] + d.back().second )
                    d.pop_back();
                d.push_back( { s, i } );
                dpCrt[s - MIN_S] = dpPrv[d.front().first - MIN_S] - i + d.front().second;
            }
        }
    } else {
        for ( int r = 0; r < x; r++ ) {
            deque<pair<int, int>> d;
            for ( int i = 0, s = MAX_S - r; s >= MIN_S; i++, s -= x ) {
                if ( !d.empty() && i - d.front().second > k )
                    d.pop_front();
                while ( !d.empty() && dpPrv[s - MIN_S] + i >= dpPrv[d.back().first - MIN_S] + d.back().second )
                    d.pop_back();
                d.push_back( { s, i } );
                dpCrt[s - MIN_S] = dpPrv[d.front().first - MIN_S] - i + d.front().second;
            }
        }
    }

    for ( int s = MIN_S; s <= MAX_S; s++ )
        dpCrt[s - MIN_S] = (dpCrt[s - MIN_S] <= -INF + m ? -INF : dpCrt[s - MIN_S]);
}



int main() {
    long long l, u = 0, t = 0;

    cin >> m >> l;
    MIN_S = -m * m;
    MAX_S = m * m;
    for ( int i = -m; i <= m; i++ ) {
        cin >> untaken[i];
        u += untaken[i];
    }

    if ( l < 0 ) {
        for ( int i = 1; i <= m; i++ )
            swap( untaken[i], untaken[-i] );
        l = -l;
    }

    long long s = 0;
    for ( int i = -m; i <= 0; i++ ) {
        long long x = untaken[i];
        s += i * x;
        taken[i] += x;
        untaken[i] -= x;
        t += x;
        u -= x;
    }
    for ( int i = 1; i <= m; i++ ) {
        long long x = min( untaken[i], (l - s) / i );
        s += i * x;
        taken[i] += x;
        untaken[i] -= x;
        t += x;
        u -= x;
    }

    if ( s + m < l ) {
        for ( int i = -m; i < 0; i++ ) {
            long long x = min( taken[i], (l - s) / (-i) );
            s -= i * x;
            taken[i] -= x;
            untaken[i] += x;
            t -= x;
            u += x;
        }
    }

    /*cout << s << "\n";
    for ( int i = -m; i <= m; i++ )
        cout << i << " " << taken[i] << " " << untaken[i] << "\n";*/

    for ( int s = MIN_S; s <= MAX_S; s++ )
        dpCrt[s - MIN_S] = -INF;
    dpCrt[0 - MIN_S] = 0;

    for ( int i = -m; i <= m; i++ ) {
        add( i, min( (long long)m, untaken[i] ) );
        substract( i, min( (long long)m, taken[i] ) );
    }


    if ( l - s > MAX_S || dpCrt[l - s - MIN_S] == -INF )
        cout << "impossible\n";
    else
        cout << t + dpCrt[l - s - MIN_S] << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3164 KB Output is correct
2 Correct 3 ms 3164 KB Output is correct
3 Correct 2 ms 3164 KB Output is correct
4 Correct 6 ms 3164 KB Output is correct
5 Correct 38 ms 3164 KB Output is correct
6 Correct 37 ms 3164 KB Output is correct
7 Correct 37 ms 3236 KB Output is correct
8 Correct 40 ms 3160 KB Output is correct
9 Correct 38 ms 3164 KB Output is correct
10 Correct 38 ms 3160 KB Output is correct
11 Correct 38 ms 3160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3164 KB Output is correct
2 Correct 3 ms 3164 KB Output is correct
3 Correct 2 ms 3164 KB Output is correct
4 Correct 6 ms 3164 KB Output is correct
5 Correct 38 ms 3164 KB Output is correct
6 Correct 37 ms 3164 KB Output is correct
7 Correct 37 ms 3236 KB Output is correct
8 Correct 40 ms 3160 KB Output is correct
9 Correct 38 ms 3164 KB Output is correct
10 Correct 38 ms 3160 KB Output is correct
11 Correct 38 ms 3160 KB Output is correct
12 Correct 3 ms 3160 KB Output is correct
13 Correct 4 ms 3160 KB Output is correct
14 Correct 2 ms 3160 KB Output is correct
15 Correct 6 ms 3160 KB Output is correct
16 Correct 38 ms 3164 KB Output is correct
17 Correct 38 ms 3164 KB Output is correct
18 Correct 37 ms 3244 KB Output is correct
19 Correct 39 ms 3260 KB Output is correct
20 Correct 38 ms 3164 KB Output is correct
21 Correct 42 ms 3160 KB Output is correct
22 Correct 38 ms 3164 KB Output is correct
23 Correct 154 ms 3372 KB Output is correct
24 Correct 152 ms 3244 KB Output is correct
25 Correct 152 ms 3244 KB Output is correct
26 Correct 168 ms 3164 KB Output is correct
27 Correct 165 ms 3160 KB Output is correct
28 Correct 150 ms 3160 KB Output is correct
29 Correct 151 ms 3160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3164 KB Output is correct
2 Correct 18 ms 3164 KB Output is correct
3 Correct 19 ms 3256 KB Output is correct
4 Correct 18 ms 3164 KB Output is correct
5 Correct 18 ms 3264 KB Output is correct
6 Correct 19 ms 3164 KB Output is correct
7 Correct 18 ms 3164 KB Output is correct
8 Correct 18 ms 3164 KB Output is correct
9 Correct 18 ms 3256 KB Output is correct
10 Correct 18 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3164 KB Output is correct
2 Correct 18 ms 3164 KB Output is correct
3 Correct 19 ms 3256 KB Output is correct
4 Correct 18 ms 3164 KB Output is correct
5 Correct 18 ms 3264 KB Output is correct
6 Correct 19 ms 3164 KB Output is correct
7 Correct 18 ms 3164 KB Output is correct
8 Correct 18 ms 3164 KB Output is correct
9 Correct 18 ms 3256 KB Output is correct
10 Correct 18 ms 3164 KB Output is correct
11 Correct 2 ms 3164 KB Output is correct
12 Correct 4 ms 3164 KB Output is correct
13 Correct 2 ms 3164 KB Output is correct
14 Correct 6 ms 3164 KB Output is correct
15 Correct 18 ms 3260 KB Output is correct
16 Correct 18 ms 3256 KB Output is correct
17 Correct 18 ms 3164 KB Output is correct
18 Correct 18 ms 3264 KB Output is correct
19 Correct 18 ms 3164 KB Output is correct
20 Correct 18 ms 3260 KB Output is correct
21 Correct 18 ms 3260 KB Output is correct
22 Correct 18 ms 3164 KB Output is correct
23 Correct 18 ms 3164 KB Output is correct
24 Correct 18 ms 3164 KB Output is correct
25 Correct 21 ms 3164 KB Output is correct
26 Correct 19 ms 3164 KB Output is correct
27 Correct 18 ms 3252 KB Output is correct
28 Correct 20 ms 3256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3164 KB Output is correct
2 Correct 18 ms 3164 KB Output is correct
3 Correct 19 ms 3256 KB Output is correct
4 Correct 18 ms 3164 KB Output is correct
5 Correct 18 ms 3264 KB Output is correct
6 Correct 19 ms 3164 KB Output is correct
7 Correct 18 ms 3164 KB Output is correct
8 Correct 18 ms 3164 KB Output is correct
9 Correct 18 ms 3256 KB Output is correct
10 Correct 18 ms 3164 KB Output is correct
11 Correct 6 ms 3160 KB Output is correct
12 Correct 18 ms 3164 KB Output is correct
13 Correct 18 ms 3164 KB Output is correct
14 Correct 18 ms 3164 KB Output is correct
15 Correct 18 ms 3164 KB Output is correct
16 Correct 18 ms 3256 KB Output is correct
17 Correct 18 ms 3164 KB Output is correct
18 Correct 18 ms 3260 KB Output is correct
19 Correct 18 ms 3160 KB Output is correct
20 Correct 21 ms 3160 KB Output is correct
21 Correct 39 ms 3236 KB Output is correct
22 Correct 37 ms 3236 KB Output is correct
23 Correct 37 ms 3164 KB Output is correct
24 Correct 38 ms 3164 KB Output is correct
25 Correct 38 ms 3160 KB Output is correct
26 Correct 39 ms 3164 KB Output is correct
27 Correct 43 ms 3248 KB Output is correct
28 Correct 38 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3164 KB Output is correct
2 Correct 3 ms 3164 KB Output is correct
3 Correct 2 ms 3164 KB Output is correct
4 Correct 6 ms 3164 KB Output is correct
5 Correct 38 ms 3164 KB Output is correct
6 Correct 37 ms 3164 KB Output is correct
7 Correct 37 ms 3236 KB Output is correct
8 Correct 40 ms 3160 KB Output is correct
9 Correct 38 ms 3164 KB Output is correct
10 Correct 38 ms 3160 KB Output is correct
11 Correct 38 ms 3160 KB Output is correct
12 Correct 6 ms 3164 KB Output is correct
13 Correct 18 ms 3164 KB Output is correct
14 Correct 19 ms 3256 KB Output is correct
15 Correct 18 ms 3164 KB Output is correct
16 Correct 18 ms 3264 KB Output is correct
17 Correct 19 ms 3164 KB Output is correct
18 Correct 18 ms 3164 KB Output is correct
19 Correct 18 ms 3164 KB Output is correct
20 Correct 18 ms 3256 KB Output is correct
21 Correct 18 ms 3164 KB Output is correct
22 Correct 2 ms 3164 KB Output is correct
23 Correct 4 ms 3164 KB Output is correct
24 Correct 2 ms 3164 KB Output is correct
25 Correct 6 ms 3164 KB Output is correct
26 Correct 18 ms 3260 KB Output is correct
27 Correct 18 ms 3256 KB Output is correct
28 Correct 18 ms 3164 KB Output is correct
29 Correct 18 ms 3264 KB Output is correct
30 Correct 18 ms 3164 KB Output is correct
31 Correct 18 ms 3260 KB Output is correct
32 Correct 18 ms 3260 KB Output is correct
33 Correct 18 ms 3164 KB Output is correct
34 Correct 18 ms 3164 KB Output is correct
35 Correct 18 ms 3164 KB Output is correct
36 Correct 21 ms 3164 KB Output is correct
37 Correct 19 ms 3164 KB Output is correct
38 Correct 18 ms 3252 KB Output is correct
39 Correct 20 ms 3256 KB Output is correct
40 Correct 6 ms 3160 KB Output is correct
41 Correct 18 ms 3164 KB Output is correct
42 Correct 18 ms 3164 KB Output is correct
43 Correct 18 ms 3164 KB Output is correct
44 Correct 18 ms 3164 KB Output is correct
45 Correct 18 ms 3256 KB Output is correct
46 Correct 18 ms 3164 KB Output is correct
47 Correct 18 ms 3260 KB Output is correct
48 Correct 18 ms 3160 KB Output is correct
49 Correct 21 ms 3160 KB Output is correct
50 Correct 39 ms 3236 KB Output is correct
51 Correct 37 ms 3236 KB Output is correct
52 Correct 37 ms 3164 KB Output is correct
53 Correct 38 ms 3164 KB Output is correct
54 Correct 38 ms 3160 KB Output is correct
55 Correct 39 ms 3164 KB Output is correct
56 Correct 43 ms 3248 KB Output is correct
57 Correct 38 ms 3164 KB Output is correct
58 Correct 2 ms 3160 KB Output is correct
59 Correct 3 ms 3160 KB Output is correct
60 Correct 2 ms 3164 KB Output is correct
61 Correct 6 ms 3252 KB Output is correct
62 Correct 38 ms 3164 KB Output is correct
63 Correct 38 ms 3164 KB Output is correct
64 Correct 38 ms 3164 KB Output is correct
65 Correct 38 ms 3260 KB Output is correct
66 Correct 37 ms 3160 KB Output is correct
67 Correct 37 ms 3160 KB Output is correct
68 Correct 38 ms 3160 KB Output is correct
69 Correct 19 ms 3252 KB Output is correct
70 Correct 18 ms 3164 KB Output is correct
71 Correct 18 ms 3164 KB Output is correct
72 Correct 18 ms 3164 KB Output is correct
73 Correct 18 ms 3164 KB Output is correct
74 Correct 18 ms 3164 KB Output is correct
75 Correct 18 ms 3160 KB Output is correct
76 Correct 18 ms 3252 KB Output is correct
77 Correct 19 ms 3164 KB Output is correct
78 Correct 21 ms 3164 KB Output is correct
79 Correct 18 ms 3164 KB Output is correct
80 Correct 23 ms 3260 KB Output is correct
81 Correct 22 ms 3164 KB Output is correct
82 Correct 18 ms 3256 KB Output is correct
83 Correct 37 ms 3164 KB Output is correct
84 Correct 39 ms 3240 KB Output is correct
85 Correct 38 ms 3164 KB Output is correct
86 Correct 37 ms 3160 KB Output is correct
87 Correct 37 ms 3160 KB Output is correct
88 Correct 37 ms 3164 KB Output is correct
89 Correct 38 ms 3164 KB Output is correct
90 Correct 42 ms 3160 KB Output is correct
91 Correct 37 ms 3236 KB Output is correct
92 Correct 37 ms 3160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3164 KB Output is correct
2 Correct 18 ms 3164 KB Output is correct
3 Correct 19 ms 3256 KB Output is correct
4 Correct 18 ms 3164 KB Output is correct
5 Correct 18 ms 3264 KB Output is correct
6 Correct 19 ms 3164 KB Output is correct
7 Correct 18 ms 3164 KB Output is correct
8 Correct 18 ms 3164 KB Output is correct
9 Correct 18 ms 3256 KB Output is correct
10 Correct 18 ms 3164 KB Output is correct
11 Correct 6 ms 3160 KB Output is correct
12 Correct 18 ms 3164 KB Output is correct
13 Correct 18 ms 3164 KB Output is correct
14 Correct 18 ms 3164 KB Output is correct
15 Correct 18 ms 3164 KB Output is correct
16 Correct 18 ms 3256 KB Output is correct
17 Correct 18 ms 3164 KB Output is correct
18 Correct 18 ms 3260 KB Output is correct
19 Correct 18 ms 3160 KB Output is correct
20 Correct 21 ms 3160 KB Output is correct
21 Correct 39 ms 3236 KB Output is correct
22 Correct 37 ms 3236 KB Output is correct
23 Correct 37 ms 3164 KB Output is correct
24 Correct 38 ms 3164 KB Output is correct
25 Correct 38 ms 3160 KB Output is correct
26 Correct 39 ms 3164 KB Output is correct
27 Correct 43 ms 3248 KB Output is correct
28 Correct 38 ms 3164 KB Output is correct
29 Correct 7 ms 3164 KB Output is correct
30 Correct 18 ms 3164 KB Output is correct
31 Correct 18 ms 3256 KB Output is correct
32 Correct 18 ms 3164 KB Output is correct
33 Correct 18 ms 3160 KB Output is correct
34 Correct 18 ms 3164 KB Output is correct
35 Correct 18 ms 3164 KB Output is correct
36 Correct 18 ms 3256 KB Output is correct
37 Correct 18 ms 3164 KB Output is correct
38 Correct 18 ms 3164 KB Output is correct
39 Correct 38 ms 3160 KB Output is correct
40 Correct 38 ms 3164 KB Output is correct
41 Correct 37 ms 3164 KB Output is correct
42 Correct 38 ms 3240 KB Output is correct
43 Correct 38 ms 3160 KB Output is correct
44 Correct 42 ms 3164 KB Output is correct
45 Correct 38 ms 3164 KB Output is correct
46 Correct 45 ms 3164 KB Output is correct
47 Correct 155 ms 3264 KB Output is correct
48 Correct 151 ms 3252 KB Output is correct
49 Correct 151 ms 3416 KB Output is correct
50 Correct 153 ms 3244 KB Output is correct
51 Correct 152 ms 3244 KB Output is correct
52 Correct 153 ms 3160 KB Output is correct
53 Correct 150 ms 3244 KB Output is correct
54 Correct 152 ms 3244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3164 KB Output is correct
2 Correct 3 ms 3164 KB Output is correct
3 Correct 2 ms 3164 KB Output is correct
4 Correct 6 ms 3164 KB Output is correct
5 Correct 38 ms 3164 KB Output is correct
6 Correct 37 ms 3164 KB Output is correct
7 Correct 37 ms 3236 KB Output is correct
8 Correct 40 ms 3160 KB Output is correct
9 Correct 38 ms 3164 KB Output is correct
10 Correct 38 ms 3160 KB Output is correct
11 Correct 38 ms 3160 KB Output is correct
12 Correct 3 ms 3160 KB Output is correct
13 Correct 4 ms 3160 KB Output is correct
14 Correct 2 ms 3160 KB Output is correct
15 Correct 6 ms 3160 KB Output is correct
16 Correct 38 ms 3164 KB Output is correct
17 Correct 38 ms 3164 KB Output is correct
18 Correct 37 ms 3244 KB Output is correct
19 Correct 39 ms 3260 KB Output is correct
20 Correct 38 ms 3164 KB Output is correct
21 Correct 42 ms 3160 KB Output is correct
22 Correct 38 ms 3164 KB Output is correct
23 Correct 154 ms 3372 KB Output is correct
24 Correct 152 ms 3244 KB Output is correct
25 Correct 152 ms 3244 KB Output is correct
26 Correct 168 ms 3164 KB Output is correct
27 Correct 165 ms 3160 KB Output is correct
28 Correct 150 ms 3160 KB Output is correct
29 Correct 151 ms 3160 KB Output is correct
30 Correct 6 ms 3164 KB Output is correct
31 Correct 18 ms 3164 KB Output is correct
32 Correct 19 ms 3256 KB Output is correct
33 Correct 18 ms 3164 KB Output is correct
34 Correct 18 ms 3264 KB Output is correct
35 Correct 19 ms 3164 KB Output is correct
36 Correct 18 ms 3164 KB Output is correct
37 Correct 18 ms 3164 KB Output is correct
38 Correct 18 ms 3256 KB Output is correct
39 Correct 18 ms 3164 KB Output is correct
40 Correct 2 ms 3164 KB Output is correct
41 Correct 4 ms 3164 KB Output is correct
42 Correct 2 ms 3164 KB Output is correct
43 Correct 6 ms 3164 KB Output is correct
44 Correct 18 ms 3260 KB Output is correct
45 Correct 18 ms 3256 KB Output is correct
46 Correct 18 ms 3164 KB Output is correct
47 Correct 18 ms 3264 KB Output is correct
48 Correct 18 ms 3164 KB Output is correct
49 Correct 18 ms 3260 KB Output is correct
50 Correct 18 ms 3260 KB Output is correct
51 Correct 18 ms 3164 KB Output is correct
52 Correct 18 ms 3164 KB Output is correct
53 Correct 18 ms 3164 KB Output is correct
54 Correct 21 ms 3164 KB Output is correct
55 Correct 19 ms 3164 KB Output is correct
56 Correct 18 ms 3252 KB Output is correct
57 Correct 20 ms 3256 KB Output is correct
58 Correct 6 ms 3160 KB Output is correct
59 Correct 18 ms 3164 KB Output is correct
60 Correct 18 ms 3164 KB Output is correct
61 Correct 18 ms 3164 KB Output is correct
62 Correct 18 ms 3164 KB Output is correct
63 Correct 18 ms 3256 KB Output is correct
64 Correct 18 ms 3164 KB Output is correct
65 Correct 18 ms 3260 KB Output is correct
66 Correct 18 ms 3160 KB Output is correct
67 Correct 21 ms 3160 KB Output is correct
68 Correct 39 ms 3236 KB Output is correct
69 Correct 37 ms 3236 KB Output is correct
70 Correct 37 ms 3164 KB Output is correct
71 Correct 38 ms 3164 KB Output is correct
72 Correct 38 ms 3160 KB Output is correct
73 Correct 39 ms 3164 KB Output is correct
74 Correct 43 ms 3248 KB Output is correct
75 Correct 38 ms 3164 KB Output is correct
76 Correct 2 ms 3160 KB Output is correct
77 Correct 3 ms 3160 KB Output is correct
78 Correct 2 ms 3164 KB Output is correct
79 Correct 6 ms 3252 KB Output is correct
80 Correct 38 ms 3164 KB Output is correct
81 Correct 38 ms 3164 KB Output is correct
82 Correct 38 ms 3164 KB Output is correct
83 Correct 38 ms 3260 KB Output is correct
84 Correct 37 ms 3160 KB Output is correct
85 Correct 37 ms 3160 KB Output is correct
86 Correct 38 ms 3160 KB Output is correct
87 Correct 19 ms 3252 KB Output is correct
88 Correct 18 ms 3164 KB Output is correct
89 Correct 18 ms 3164 KB Output is correct
90 Correct 18 ms 3164 KB Output is correct
91 Correct 18 ms 3164 KB Output is correct
92 Correct 18 ms 3164 KB Output is correct
93 Correct 18 ms 3160 KB Output is correct
94 Correct 18 ms 3252 KB Output is correct
95 Correct 19 ms 3164 KB Output is correct
96 Correct 21 ms 3164 KB Output is correct
97 Correct 18 ms 3164 KB Output is correct
98 Correct 23 ms 3260 KB Output is correct
99 Correct 22 ms 3164 KB Output is correct
100 Correct 18 ms 3256 KB Output is correct
101 Correct 37 ms 3164 KB Output is correct
102 Correct 39 ms 3240 KB Output is correct
103 Correct 38 ms 3164 KB Output is correct
104 Correct 37 ms 3160 KB Output is correct
105 Correct 37 ms 3160 KB Output is correct
106 Correct 37 ms 3164 KB Output is correct
107 Correct 38 ms 3164 KB Output is correct
108 Correct 42 ms 3160 KB Output is correct
109 Correct 37 ms 3236 KB Output is correct
110 Correct 37 ms 3160 KB Output is correct
111 Correct 7 ms 3164 KB Output is correct
112 Correct 18 ms 3164 KB Output is correct
113 Correct 18 ms 3256 KB Output is correct
114 Correct 18 ms 3164 KB Output is correct
115 Correct 18 ms 3160 KB Output is correct
116 Correct 18 ms 3164 KB Output is correct
117 Correct 18 ms 3164 KB Output is correct
118 Correct 18 ms 3256 KB Output is correct
119 Correct 18 ms 3164 KB Output is correct
120 Correct 18 ms 3164 KB Output is correct
121 Correct 38 ms 3160 KB Output is correct
122 Correct 38 ms 3164 KB Output is correct
123 Correct 37 ms 3164 KB Output is correct
124 Correct 38 ms 3240 KB Output is correct
125 Correct 38 ms 3160 KB Output is correct
126 Correct 42 ms 3164 KB Output is correct
127 Correct 38 ms 3164 KB Output is correct
128 Correct 45 ms 3164 KB Output is correct
129 Correct 155 ms 3264 KB Output is correct
130 Correct 151 ms 3252 KB Output is correct
131 Correct 151 ms 3416 KB Output is correct
132 Correct 153 ms 3244 KB Output is correct
133 Correct 152 ms 3244 KB Output is correct
134 Correct 153 ms 3160 KB Output is correct
135 Correct 150 ms 3244 KB Output is correct
136 Correct 152 ms 3244 KB Output is correct
137 Correct 2 ms 3160 KB Output is correct
138 Correct 3 ms 3164 KB Output is correct
139 Correct 2 ms 3416 KB Output is correct
140 Correct 6 ms 3260 KB Output is correct
141 Correct 37 ms 3164 KB Output is correct
142 Correct 38 ms 3164 KB Output is correct
143 Correct 41 ms 3412 KB Output is correct
144 Correct 38 ms 3164 KB Output is correct
145 Correct 38 ms 3164 KB Output is correct
146 Correct 38 ms 3160 KB Output is correct
147 Correct 38 ms 3164 KB Output is correct
148 Correct 152 ms 3252 KB Output is correct
149 Correct 151 ms 3160 KB Output is correct
150 Correct 151 ms 3244 KB Output is correct
151 Correct 152 ms 3248 KB Output is correct
152 Correct 155 ms 3408 KB Output is correct
153 Correct 151 ms 3164 KB Output is correct
154 Correct 152 ms 3252 KB Output is correct
155 Correct 18 ms 3160 KB Output is correct
156 Correct 18 ms 3164 KB Output is correct
157 Correct 18 ms 3164 KB Output is correct
158 Correct 18 ms 3256 KB Output is correct
159 Correct 18 ms 3164 KB Output is correct
160 Correct 18 ms 3164 KB Output is correct
161 Correct 18 ms 3416 KB Output is correct
162 Correct 18 ms 3164 KB Output is correct
163 Correct 18 ms 3164 KB Output is correct
164 Correct 40 ms 3240 KB Output is correct
165 Correct 37 ms 3164 KB Output is correct
166 Correct 38 ms 3240 KB Output is correct
167 Correct 39 ms 3164 KB Output is correct
168 Correct 40 ms 3164 KB Output is correct
169 Correct 38 ms 3164 KB Output is correct
170 Correct 18 ms 3164 KB Output is correct
171 Correct 18 ms 3164 KB Output is correct
172 Correct 18 ms 3252 KB Output is correct
173 Correct 18 ms 3164 KB Output is correct
174 Correct 18 ms 3164 KB Output is correct
175 Correct 38 ms 3164 KB Output is correct
176 Correct 38 ms 3160 KB Output is correct
177 Correct 37 ms 3164 KB Output is correct
178 Correct 38 ms 3164 KB Output is correct
179 Correct 151 ms 3164 KB Output is correct
180 Correct 151 ms 3160 KB Output is correct
181 Correct 151 ms 3160 KB Output is correct
182 Correct 153 ms 3160 KB Output is correct
183 Correct 161 ms 3244 KB Output is correct
184 Correct 154 ms 3408 KB Output is correct
185 Correct 154 ms 3244 KB Output is correct
186 Correct 153 ms 3160 KB Output is correct
187 Correct 154 ms 3244 KB Output is correct
188 Correct 151 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3164 KB Output is correct
2 Correct 18 ms 3164 KB Output is correct
3 Correct 19 ms 3256 KB Output is correct
4 Correct 18 ms 3164 KB Output is correct
5 Correct 18 ms 3264 KB Output is correct
6 Correct 19 ms 3164 KB Output is correct
7 Correct 18 ms 3164 KB Output is correct
8 Correct 18 ms 3164 KB Output is correct
9 Correct 18 ms 3256 KB Output is correct
10 Correct 18 ms 3164 KB Output is correct
11 Correct 6 ms 3160 KB Output is correct
12 Correct 18 ms 3164 KB Output is correct
13 Correct 18 ms 3164 KB Output is correct
14 Correct 18 ms 3164 KB Output is correct
15 Correct 18 ms 3164 KB Output is correct
16 Correct 18 ms 3256 KB Output is correct
17 Correct 18 ms 3164 KB Output is correct
18 Correct 18 ms 3260 KB Output is correct
19 Correct 18 ms 3160 KB Output is correct
20 Correct 21 ms 3160 KB Output is correct
21 Correct 39 ms 3236 KB Output is correct
22 Correct 37 ms 3236 KB Output is correct
23 Correct 37 ms 3164 KB Output is correct
24 Correct 38 ms 3164 KB Output is correct
25 Correct 38 ms 3160 KB Output is correct
26 Correct 39 ms 3164 KB Output is correct
27 Correct 43 ms 3248 KB Output is correct
28 Correct 38 ms 3164 KB Output is correct
29 Correct 7 ms 3164 KB Output is correct
30 Correct 18 ms 3164 KB Output is correct
31 Correct 18 ms 3256 KB Output is correct
32 Correct 18 ms 3164 KB Output is correct
33 Correct 18 ms 3160 KB Output is correct
34 Correct 18 ms 3164 KB Output is correct
35 Correct 18 ms 3164 KB Output is correct
36 Correct 18 ms 3256 KB Output is correct
37 Correct 18 ms 3164 KB Output is correct
38 Correct 18 ms 3164 KB Output is correct
39 Correct 38 ms 3160 KB Output is correct
40 Correct 38 ms 3164 KB Output is correct
41 Correct 37 ms 3164 KB Output is correct
42 Correct 38 ms 3240 KB Output is correct
43 Correct 38 ms 3160 KB Output is correct
44 Correct 42 ms 3164 KB Output is correct
45 Correct 38 ms 3164 KB Output is correct
46 Correct 45 ms 3164 KB Output is correct
47 Correct 155 ms 3264 KB Output is correct
48 Correct 151 ms 3252 KB Output is correct
49 Correct 151 ms 3416 KB Output is correct
50 Correct 153 ms 3244 KB Output is correct
51 Correct 152 ms 3244 KB Output is correct
52 Correct 153 ms 3160 KB Output is correct
53 Correct 150 ms 3244 KB Output is correct
54 Correct 152 ms 3244 KB Output is correct
55 Correct 7 ms 3164 KB Output is correct
56 Correct 18 ms 3164 KB Output is correct
57 Correct 18 ms 3260 KB Output is correct
58 Correct 18 ms 3160 KB Output is correct
59 Correct 18 ms 3160 KB Output is correct
60 Correct 18 ms 3160 KB Output is correct
61 Correct 18 ms 3164 KB Output is correct
62 Correct 18 ms 3164 KB Output is correct
63 Correct 18 ms 3164 KB Output is correct
64 Correct 18 ms 3160 KB Output is correct
65 Correct 37 ms 3164 KB Output is correct
66 Correct 38 ms 3236 KB Output is correct
67 Correct 38 ms 3160 KB Output is correct
68 Correct 39 ms 3240 KB Output is correct
69 Correct 38 ms 3164 KB Output is correct
70 Correct 37 ms 3160 KB Output is correct
71 Correct 38 ms 3240 KB Output is correct
72 Correct 38 ms 3164 KB Output is correct
73 Correct 151 ms 3164 KB Output is correct
74 Correct 150 ms 3248 KB Output is correct
75 Correct 151 ms 3160 KB Output is correct
76 Correct 150 ms 3240 KB Output is correct
77 Correct 155 ms 3416 KB Output is correct
78 Correct 151 ms 3160 KB Output is correct
79 Correct 151 ms 3248 KB Output is correct
80 Correct 151 ms 3252 KB Output is correct
81 Correct 2947 ms 3288 KB Output is correct
82 Correct 2957 ms 3300 KB Output is correct
83 Correct 2947 ms 3292 KB Output is correct
84 Correct 2976 ms 3292 KB Output is correct
85 Correct 2941 ms 3296 KB Output is correct
86 Correct 2934 ms 3160 KB Output is correct
87 Correct 2938 ms 3292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3164 KB Output is correct
2 Correct 3 ms 3164 KB Output is correct
3 Correct 2 ms 3164 KB Output is correct
4 Correct 6 ms 3164 KB Output is correct
5 Correct 38 ms 3164 KB Output is correct
6 Correct 37 ms 3164 KB Output is correct
7 Correct 37 ms 3236 KB Output is correct
8 Correct 40 ms 3160 KB Output is correct
9 Correct 38 ms 3164 KB Output is correct
10 Correct 38 ms 3160 KB Output is correct
11 Correct 38 ms 3160 KB Output is correct
12 Correct 3 ms 3160 KB Output is correct
13 Correct 4 ms 3160 KB Output is correct
14 Correct 2 ms 3160 KB Output is correct
15 Correct 6 ms 3160 KB Output is correct
16 Correct 38 ms 3164 KB Output is correct
17 Correct 38 ms 3164 KB Output is correct
18 Correct 37 ms 3244 KB Output is correct
19 Correct 39 ms 3260 KB Output is correct
20 Correct 38 ms 3164 KB Output is correct
21 Correct 42 ms 3160 KB Output is correct
22 Correct 38 ms 3164 KB Output is correct
23 Correct 154 ms 3372 KB Output is correct
24 Correct 152 ms 3244 KB Output is correct
25 Correct 152 ms 3244 KB Output is correct
26 Correct 168 ms 3164 KB Output is correct
27 Correct 165 ms 3160 KB Output is correct
28 Correct 150 ms 3160 KB Output is correct
29 Correct 151 ms 3160 KB Output is correct
30 Correct 6 ms 3164 KB Output is correct
31 Correct 18 ms 3164 KB Output is correct
32 Correct 19 ms 3256 KB Output is correct
33 Correct 18 ms 3164 KB Output is correct
34 Correct 18 ms 3264 KB Output is correct
35 Correct 19 ms 3164 KB Output is correct
36 Correct 18 ms 3164 KB Output is correct
37 Correct 18 ms 3164 KB Output is correct
38 Correct 18 ms 3256 KB Output is correct
39 Correct 18 ms 3164 KB Output is correct
40 Correct 2 ms 3164 KB Output is correct
41 Correct 4 ms 3164 KB Output is correct
42 Correct 2 ms 3164 KB Output is correct
43 Correct 6 ms 3164 KB Output is correct
44 Correct 18 ms 3260 KB Output is correct
45 Correct 18 ms 3256 KB Output is correct
46 Correct 18 ms 3164 KB Output is correct
47 Correct 18 ms 3264 KB Output is correct
48 Correct 18 ms 3164 KB Output is correct
49 Correct 18 ms 3260 KB Output is correct
50 Correct 18 ms 3260 KB Output is correct
51 Correct 18 ms 3164 KB Output is correct
52 Correct 18 ms 3164 KB Output is correct
53 Correct 18 ms 3164 KB Output is correct
54 Correct 21 ms 3164 KB Output is correct
55 Correct 19 ms 3164 KB Output is correct
56 Correct 18 ms 3252 KB Output is correct
57 Correct 20 ms 3256 KB Output is correct
58 Correct 6 ms 3160 KB Output is correct
59 Correct 18 ms 3164 KB Output is correct
60 Correct 18 ms 3164 KB Output is correct
61 Correct 18 ms 3164 KB Output is correct
62 Correct 18 ms 3164 KB Output is correct
63 Correct 18 ms 3256 KB Output is correct
64 Correct 18 ms 3164 KB Output is correct
65 Correct 18 ms 3260 KB Output is correct
66 Correct 18 ms 3160 KB Output is correct
67 Correct 21 ms 3160 KB Output is correct
68 Correct 39 ms 3236 KB Output is correct
69 Correct 37 ms 3236 KB Output is correct
70 Correct 37 ms 3164 KB Output is correct
71 Correct 38 ms 3164 KB Output is correct
72 Correct 38 ms 3160 KB Output is correct
73 Correct 39 ms 3164 KB Output is correct
74 Correct 43 ms 3248 KB Output is correct
75 Correct 38 ms 3164 KB Output is correct
76 Correct 2 ms 3160 KB Output is correct
77 Correct 3 ms 3160 KB Output is correct
78 Correct 2 ms 3164 KB Output is correct
79 Correct 6 ms 3252 KB Output is correct
80 Correct 38 ms 3164 KB Output is correct
81 Correct 38 ms 3164 KB Output is correct
82 Correct 38 ms 3164 KB Output is correct
83 Correct 38 ms 3260 KB Output is correct
84 Correct 37 ms 3160 KB Output is correct
85 Correct 37 ms 3160 KB Output is correct
86 Correct 38 ms 3160 KB Output is correct
87 Correct 19 ms 3252 KB Output is correct
88 Correct 18 ms 3164 KB Output is correct
89 Correct 18 ms 3164 KB Output is correct
90 Correct 18 ms 3164 KB Output is correct
91 Correct 18 ms 3164 KB Output is correct
92 Correct 18 ms 3164 KB Output is correct
93 Correct 18 ms 3160 KB Output is correct
94 Correct 18 ms 3252 KB Output is correct
95 Correct 19 ms 3164 KB Output is correct
96 Correct 21 ms 3164 KB Output is correct
97 Correct 18 ms 3164 KB Output is correct
98 Correct 23 ms 3260 KB Output is correct
99 Correct 22 ms 3164 KB Output is correct
100 Correct 18 ms 3256 KB Output is correct
101 Correct 37 ms 3164 KB Output is correct
102 Correct 39 ms 3240 KB Output is correct
103 Correct 38 ms 3164 KB Output is correct
104 Correct 37 ms 3160 KB Output is correct
105 Correct 37 ms 3160 KB Output is correct
106 Correct 37 ms 3164 KB Output is correct
107 Correct 38 ms 3164 KB Output is correct
108 Correct 42 ms 3160 KB Output is correct
109 Correct 37 ms 3236 KB Output is correct
110 Correct 37 ms 3160 KB Output is correct
111 Correct 7 ms 3164 KB Output is correct
112 Correct 18 ms 3164 KB Output is correct
113 Correct 18 ms 3256 KB Output is correct
114 Correct 18 ms 3164 KB Output is correct
115 Correct 18 ms 3160 KB Output is correct
116 Correct 18 ms 3164 KB Output is correct
117 Correct 18 ms 3164 KB Output is correct
118 Correct 18 ms 3256 KB Output is correct
119 Correct 18 ms 3164 KB Output is correct
120 Correct 18 ms 3164 KB Output is correct
121 Correct 38 ms 3160 KB Output is correct
122 Correct 38 ms 3164 KB Output is correct
123 Correct 37 ms 3164 KB Output is correct
124 Correct 38 ms 3240 KB Output is correct
125 Correct 38 ms 3160 KB Output is correct
126 Correct 42 ms 3164 KB Output is correct
127 Correct 38 ms 3164 KB Output is correct
128 Correct 45 ms 3164 KB Output is correct
129 Correct 155 ms 3264 KB Output is correct
130 Correct 151 ms 3252 KB Output is correct
131 Correct 151 ms 3416 KB Output is correct
132 Correct 153 ms 3244 KB Output is correct
133 Correct 152 ms 3244 KB Output is correct
134 Correct 153 ms 3160 KB Output is correct
135 Correct 150 ms 3244 KB Output is correct
136 Correct 152 ms 3244 KB Output is correct
137 Correct 2 ms 3160 KB Output is correct
138 Correct 3 ms 3164 KB Output is correct
139 Correct 2 ms 3416 KB Output is correct
140 Correct 6 ms 3260 KB Output is correct
141 Correct 37 ms 3164 KB Output is correct
142 Correct 38 ms 3164 KB Output is correct
143 Correct 41 ms 3412 KB Output is correct
144 Correct 38 ms 3164 KB Output is correct
145 Correct 38 ms 3164 KB Output is correct
146 Correct 38 ms 3160 KB Output is correct
147 Correct 38 ms 3164 KB Output is correct
148 Correct 152 ms 3252 KB Output is correct
149 Correct 151 ms 3160 KB Output is correct
150 Correct 151 ms 3244 KB Output is correct
151 Correct 152 ms 3248 KB Output is correct
152 Correct 155 ms 3408 KB Output is correct
153 Correct 151 ms 3164 KB Output is correct
154 Correct 152 ms 3252 KB Output is correct
155 Correct 18 ms 3160 KB Output is correct
156 Correct 18 ms 3164 KB Output is correct
157 Correct 18 ms 3164 KB Output is correct
158 Correct 18 ms 3256 KB Output is correct
159 Correct 18 ms 3164 KB Output is correct
160 Correct 18 ms 3164 KB Output is correct
161 Correct 18 ms 3416 KB Output is correct
162 Correct 18 ms 3164 KB Output is correct
163 Correct 18 ms 3164 KB Output is correct
164 Correct 40 ms 3240 KB Output is correct
165 Correct 37 ms 3164 KB Output is correct
166 Correct 38 ms 3240 KB Output is correct
167 Correct 39 ms 3164 KB Output is correct
168 Correct 40 ms 3164 KB Output is correct
169 Correct 38 ms 3164 KB Output is correct
170 Correct 18 ms 3164 KB Output is correct
171 Correct 18 ms 3164 KB Output is correct
172 Correct 18 ms 3252 KB Output is correct
173 Correct 18 ms 3164 KB Output is correct
174 Correct 18 ms 3164 KB Output is correct
175 Correct 38 ms 3164 KB Output is correct
176 Correct 38 ms 3160 KB Output is correct
177 Correct 37 ms 3164 KB Output is correct
178 Correct 38 ms 3164 KB Output is correct
179 Correct 151 ms 3164 KB Output is correct
180 Correct 151 ms 3160 KB Output is correct
181 Correct 151 ms 3160 KB Output is correct
182 Correct 153 ms 3160 KB Output is correct
183 Correct 161 ms 3244 KB Output is correct
184 Correct 154 ms 3408 KB Output is correct
185 Correct 154 ms 3244 KB Output is correct
186 Correct 153 ms 3160 KB Output is correct
187 Correct 154 ms 3244 KB Output is correct
188 Correct 151 ms 3164 KB Output is correct
189 Correct 7 ms 3164 KB Output is correct
190 Correct 18 ms 3164 KB Output is correct
191 Correct 18 ms 3260 KB Output is correct
192 Correct 18 ms 3160 KB Output is correct
193 Correct 18 ms 3160 KB Output is correct
194 Correct 18 ms 3160 KB Output is correct
195 Correct 18 ms 3164 KB Output is correct
196 Correct 18 ms 3164 KB Output is correct
197 Correct 18 ms 3164 KB Output is correct
198 Correct 18 ms 3160 KB Output is correct
199 Correct 37 ms 3164 KB Output is correct
200 Correct 38 ms 3236 KB Output is correct
201 Correct 38 ms 3160 KB Output is correct
202 Correct 39 ms 3240 KB Output is correct
203 Correct 38 ms 3164 KB Output is correct
204 Correct 37 ms 3160 KB Output is correct
205 Correct 38 ms 3240 KB Output is correct
206 Correct 38 ms 3164 KB Output is correct
207 Correct 151 ms 3164 KB Output is correct
208 Correct 150 ms 3248 KB Output is correct
209 Correct 151 ms 3160 KB Output is correct
210 Correct 150 ms 3240 KB Output is correct
211 Correct 155 ms 3416 KB Output is correct
212 Correct 151 ms 3160 KB Output is correct
213 Correct 151 ms 3248 KB Output is correct
214 Correct 151 ms 3252 KB Output is correct
215 Correct 2947 ms 3288 KB Output is correct
216 Correct 2957 ms 3300 KB Output is correct
217 Correct 2947 ms 3292 KB Output is correct
218 Correct 2976 ms 3292 KB Output is correct
219 Correct 2941 ms 3296 KB Output is correct
220 Correct 2934 ms 3160 KB Output is correct
221 Correct 2938 ms 3292 KB Output is correct
222 Correct 6 ms 3160 KB Output is correct
223 Correct 18 ms 3240 KB Output is correct
224 Correct 18 ms 3160 KB Output is correct
225 Correct 18 ms 3164 KB Output is correct
226 Correct 18 ms 3164 KB Output is correct
227 Correct 18 ms 3164 KB Output is correct
228 Correct 18 ms 3264 KB Output is correct
229 Correct 18 ms 3164 KB Output is correct
230 Correct 18 ms 3164 KB Output is correct
231 Correct 18 ms 3164 KB Output is correct
232 Correct 37 ms 3164 KB Output is correct
233 Correct 37 ms 3160 KB Output is correct
234 Correct 38 ms 3160 KB Output is correct
235 Correct 37 ms 3160 KB Output is correct
236 Correct 38 ms 3164 KB Output is correct
237 Correct 37 ms 3160 KB Output is correct
238 Correct 39 ms 3496 KB Output is correct
239 Correct 37 ms 3160 KB Output is correct
240 Correct 151 ms 3252 KB Output is correct
241 Correct 154 ms 3160 KB Output is correct
242 Correct 154 ms 3256 KB Output is correct
243 Correct 151 ms 3164 KB Output is correct
244 Correct 151 ms 3164 KB Output is correct
245 Correct 154 ms 3164 KB Output is correct
246 Correct 152 ms 3164 KB Output is correct
247 Correct 151 ms 3252 KB Output is correct
248 Correct 2 ms 3160 KB Output is correct
249 Correct 3 ms 3164 KB Output is correct
250 Correct 2 ms 3164 KB Output is correct
251 Correct 47 ms 3164 KB Output is correct
252 Correct 39 ms 3412 KB Output is correct
253 Correct 40 ms 3164 KB Output is correct
254 Correct 39 ms 3164 KB Output is correct
255 Correct 38 ms 3164 KB Output is correct
256 Correct 168 ms 3408 KB Output is correct
257 Correct 159 ms 3248 KB Output is correct
258 Correct 151 ms 3160 KB Output is correct
259 Correct 154 ms 3164 KB Output is correct
260 Correct 151 ms 3160 KB Output is correct
261 Correct 18 ms 3164 KB Output is correct
262 Correct 21 ms 3160 KB Output is correct
263 Correct 19 ms 3164 KB Output is correct
264 Correct 18 ms 3164 KB Output is correct
265 Correct 18 ms 3164 KB Output is correct
266 Correct 38 ms 3164 KB Output is correct
267 Correct 38 ms 3160 KB Output is correct
268 Correct 43 ms 3160 KB Output is correct
269 Correct 38 ms 3160 KB Output is correct
270 Correct 155 ms 3248 KB Output is correct
271 Correct 153 ms 3248 KB Output is correct
272 Correct 152 ms 3164 KB Output is correct
273 Correct 155 ms 3412 KB Output is correct
274 Correct 2951 ms 3296 KB Output is correct
275 Correct 2967 ms 3292 KB Output is correct
276 Correct 2959 ms 3288 KB Output is correct
277 Correct 2986 ms 3292 KB Output is correct
278 Correct 3002 ms 3292 KB Output is correct
279 Correct 2950 ms 3296 KB Output is correct
280 Correct 2983 ms 3292 KB Output is correct
281 Correct 2973 ms 3296 KB Output is correct
282 Correct 2977 ms 3304 KB Output is correct
283 Correct 2987 ms 3292 KB Output is correct