Submission #943711

# Submission time Handle Problem Language Result Execution time Memory
943711 2024-03-11T18:34:27 Z LucaIlie Uplifting Excursion (BOI22_vault) C++17
80 / 100
5000 ms 5520 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_M = 100;
const int MAX_S = MAX_M * MAX_M;
const int MIN_S = -MAX_S;
const long long INF = 1e18;
int m;
unordered_map<int, long long> taken, untaken;
unordered_map<int, long long> dpCrt, dpPrv;

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

    for ( int s = MIN_S; s <= MAX_S; s++ )
        dpCrt[s] = dpPrv[s];

    for ( int s = MIN_S; s - i * x <= MAX_S; s++ ) {
        if ( MIN_S <= s - i * x && s - i * x <= MAX_S )
            dpCrt[s] = max( dpCrt[s], dpPrv[s - i * x] + x );
    }

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

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

    for ( int s = MIN_S; s <= MAX_S; s++ )
        dpCrt[s] = dpPrv[s];

    for ( int s = MIN_S; s <= MAX_S; s++ ) {
        if ( MIN_S <= s + i * x && s + i * x <= MAX_S )
            dpCrt[s] = max( dpCrt[s], dpPrv[s + i * x] - x );
    }

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

void afis() {
    for ( int s = MIN_S; s <= MAX_S; s++ )
        cout << dpCrt[s] << " ";
    cout << "\n";
}

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

    cin >> m >> l;
    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] = -INF;
    dpCrt[0] = 0;

    for ( int i = -m; i <= m; i++ ) {
        int k, s;

        s = 0;
        k = min( (long long)m, untaken[i] );
        for ( int b = 0; s + (1 << b) <= k; s += (1 << b), b++ )
            add( (1 << b), i );
        add( k - s, i );

        s = 0;
        k = min( (long long)m, taken[i] );
        for ( int b = 0; s + (1 << b) <= k; s += (1 << b), b++ )
            substract( (1 << b), i );
        substract( k - s, i );
    }


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

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1880 KB Output is correct
2 Correct 27 ms 1884 KB Output is correct
3 Correct 13 ms 2020 KB Output is correct
4 Correct 91 ms 2000 KB Output is correct
5 Correct 854 ms 2132 KB Output is correct
6 Correct 875 ms 2024 KB Output is correct
7 Correct 522 ms 2012 KB Output is correct
8 Correct 885 ms 2008 KB Output is correct
9 Correct 1033 ms 2008 KB Output is correct
10 Correct 283 ms 2476 KB Output is correct
11 Correct 286 ms 2132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1880 KB Output is correct
2 Correct 27 ms 1884 KB Output is correct
3 Correct 13 ms 2020 KB Output is correct
4 Correct 91 ms 2000 KB Output is correct
5 Correct 854 ms 2132 KB Output is correct
6 Correct 875 ms 2024 KB Output is correct
7 Correct 522 ms 2012 KB Output is correct
8 Correct 885 ms 2008 KB Output is correct
9 Correct 1033 ms 2008 KB Output is correct
10 Correct 283 ms 2476 KB Output is correct
11 Correct 286 ms 2132 KB Output is correct
12 Correct 26 ms 1884 KB Output is correct
13 Correct 31 ms 1880 KB Output is correct
14 Correct 14 ms 2024 KB Output is correct
15 Correct 88 ms 1884 KB Output is correct
16 Correct 866 ms 2136 KB Output is correct
17 Correct 857 ms 2004 KB Output is correct
18 Correct 523 ms 1884 KB Output is correct
19 Correct 879 ms 1884 KB Output is correct
20 Correct 1036 ms 2016 KB Output is correct
21 Correct 285 ms 2476 KB Output is correct
22 Correct 285 ms 2392 KB Output is correct
23 Correct 1960 ms 2132 KB Output is correct
24 Correct 1941 ms 2012 KB Output is correct
25 Correct 1096 ms 2024 KB Output is correct
26 Correct 2397 ms 2020 KB Output is correct
27 Correct 2348 ms 2020 KB Output is correct
28 Correct 551 ms 2572 KB Output is correct
29 Correct 553 ms 2480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 2132 KB Output is correct
2 Correct 311 ms 2012 KB Output is correct
3 Correct 202 ms 1884 KB Output is correct
4 Correct 325 ms 2008 KB Output is correct
5 Correct 339 ms 1884 KB Output is correct
6 Correct 305 ms 2384 KB Output is correct
7 Correct 181 ms 1880 KB Output is correct
8 Correct 186 ms 2136 KB Output is correct
9 Correct 245 ms 2024 KB Output is correct
10 Correct 276 ms 2024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 2132 KB Output is correct
2 Correct 311 ms 2012 KB Output is correct
3 Correct 202 ms 1884 KB Output is correct
4 Correct 325 ms 2008 KB Output is correct
5 Correct 339 ms 1884 KB Output is correct
6 Correct 305 ms 2384 KB Output is correct
7 Correct 181 ms 1880 KB Output is correct
8 Correct 186 ms 2136 KB Output is correct
9 Correct 245 ms 2024 KB Output is correct
10 Correct 276 ms 2024 KB Output is correct
11 Correct 25 ms 2024 KB Output is correct
12 Correct 27 ms 1884 KB Output is correct
13 Correct 14 ms 1880 KB Output is correct
14 Correct 88 ms 2000 KB Output is correct
15 Correct 310 ms 1880 KB Output is correct
16 Correct 209 ms 2128 KB Output is correct
17 Correct 325 ms 2036 KB Output is correct
18 Correct 344 ms 2152 KB Output is correct
19 Correct 301 ms 2024 KB Output is correct
20 Correct 183 ms 2128 KB Output is correct
21 Correct 197 ms 2008 KB Output is correct
22 Correct 242 ms 2028 KB Output is correct
23 Correct 279 ms 2140 KB Output is correct
24 Correct 455 ms 2012 KB Output is correct
25 Correct 297 ms 2140 KB Output is correct
26 Correct 540 ms 2008 KB Output is correct
27 Correct 459 ms 1884 KB Output is correct
28 Correct 485 ms 2008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 2132 KB Output is correct
2 Correct 311 ms 2012 KB Output is correct
3 Correct 202 ms 1884 KB Output is correct
4 Correct 325 ms 2008 KB Output is correct
5 Correct 339 ms 1884 KB Output is correct
6 Correct 305 ms 2384 KB Output is correct
7 Correct 181 ms 1880 KB Output is correct
8 Correct 186 ms 2136 KB Output is correct
9 Correct 245 ms 2024 KB Output is correct
10 Correct 276 ms 2024 KB Output is correct
11 Correct 96 ms 1884 KB Output is correct
12 Correct 309 ms 2008 KB Output is correct
13 Correct 204 ms 2008 KB Output is correct
14 Correct 324 ms 1884 KB Output is correct
15 Correct 341 ms 2004 KB Output is correct
16 Correct 303 ms 2028 KB Output is correct
17 Correct 183 ms 2004 KB Output is correct
18 Correct 188 ms 2132 KB Output is correct
19 Correct 242 ms 1884 KB Output is correct
20 Correct 270 ms 1884 KB Output is correct
21 Correct 287 ms 2480 KB Output is correct
22 Correct 286 ms 2284 KB Output is correct
23 Correct 586 ms 2264 KB Output is correct
24 Correct 405 ms 2128 KB Output is correct
25 Correct 578 ms 2476 KB Output is correct
26 Correct 647 ms 2484 KB Output is correct
27 Correct 584 ms 2384 KB Output is correct
28 Correct 517 ms 2476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1880 KB Output is correct
2 Correct 27 ms 1884 KB Output is correct
3 Correct 13 ms 2020 KB Output is correct
4 Correct 91 ms 2000 KB Output is correct
5 Correct 854 ms 2132 KB Output is correct
6 Correct 875 ms 2024 KB Output is correct
7 Correct 522 ms 2012 KB Output is correct
8 Correct 885 ms 2008 KB Output is correct
9 Correct 1033 ms 2008 KB Output is correct
10 Correct 283 ms 2476 KB Output is correct
11 Correct 286 ms 2132 KB Output is correct
12 Correct 91 ms 2132 KB Output is correct
13 Correct 311 ms 2012 KB Output is correct
14 Correct 202 ms 1884 KB Output is correct
15 Correct 325 ms 2008 KB Output is correct
16 Correct 339 ms 1884 KB Output is correct
17 Correct 305 ms 2384 KB Output is correct
18 Correct 181 ms 1880 KB Output is correct
19 Correct 186 ms 2136 KB Output is correct
20 Correct 245 ms 2024 KB Output is correct
21 Correct 276 ms 2024 KB Output is correct
22 Correct 25 ms 2024 KB Output is correct
23 Correct 27 ms 1884 KB Output is correct
24 Correct 14 ms 1880 KB Output is correct
25 Correct 88 ms 2000 KB Output is correct
26 Correct 310 ms 1880 KB Output is correct
27 Correct 209 ms 2128 KB Output is correct
28 Correct 325 ms 2036 KB Output is correct
29 Correct 344 ms 2152 KB Output is correct
30 Correct 301 ms 2024 KB Output is correct
31 Correct 183 ms 2128 KB Output is correct
32 Correct 197 ms 2008 KB Output is correct
33 Correct 242 ms 2028 KB Output is correct
34 Correct 279 ms 2140 KB Output is correct
35 Correct 455 ms 2012 KB Output is correct
36 Correct 297 ms 2140 KB Output is correct
37 Correct 540 ms 2008 KB Output is correct
38 Correct 459 ms 1884 KB Output is correct
39 Correct 485 ms 2008 KB Output is correct
40 Correct 96 ms 1884 KB Output is correct
41 Correct 309 ms 2008 KB Output is correct
42 Correct 204 ms 2008 KB Output is correct
43 Correct 324 ms 1884 KB Output is correct
44 Correct 341 ms 2004 KB Output is correct
45 Correct 303 ms 2028 KB Output is correct
46 Correct 183 ms 2004 KB Output is correct
47 Correct 188 ms 2132 KB Output is correct
48 Correct 242 ms 1884 KB Output is correct
49 Correct 270 ms 1884 KB Output is correct
50 Correct 287 ms 2480 KB Output is correct
51 Correct 286 ms 2284 KB Output is correct
52 Correct 586 ms 2264 KB Output is correct
53 Correct 405 ms 2128 KB Output is correct
54 Correct 578 ms 2476 KB Output is correct
55 Correct 647 ms 2484 KB Output is correct
56 Correct 584 ms 2384 KB Output is correct
57 Correct 517 ms 2476 KB Output is correct
58 Correct 27 ms 1884 KB Output is correct
59 Correct 27 ms 1884 KB Output is correct
60 Correct 13 ms 1884 KB Output is correct
61 Correct 89 ms 1884 KB Output is correct
62 Correct 854 ms 2008 KB Output is correct
63 Correct 857 ms 2012 KB Output is correct
64 Correct 524 ms 2136 KB Output is correct
65 Correct 878 ms 1884 KB Output is correct
66 Correct 1058 ms 2020 KB Output is correct
67 Correct 289 ms 2360 KB Output is correct
68 Correct 292 ms 2268 KB Output is correct
69 Correct 314 ms 2132 KB Output is correct
70 Correct 203 ms 1884 KB Output is correct
71 Correct 330 ms 2016 KB Output is correct
72 Correct 338 ms 2020 KB Output is correct
73 Correct 309 ms 1884 KB Output is correct
74 Correct 181 ms 1884 KB Output is correct
75 Correct 183 ms 1880 KB Output is correct
76 Correct 241 ms 2020 KB Output is correct
77 Correct 290 ms 2008 KB Output is correct
78 Correct 467 ms 2008 KB Output is correct
79 Correct 290 ms 1880 KB Output is correct
80 Correct 527 ms 1884 KB Output is correct
81 Correct 471 ms 2012 KB Output is correct
82 Correct 485 ms 1884 KB Output is correct
83 Correct 592 ms 2268 KB Output is correct
84 Correct 411 ms 2008 KB Output is correct
85 Correct 592 ms 2360 KB Output is correct
86 Correct 661 ms 2480 KB Output is correct
87 Correct 588 ms 2384 KB Output is correct
88 Correct 528 ms 2472 KB Output is correct
89 Correct 901 ms 1884 KB Output is correct
90 Correct 1076 ms 2132 KB Output is correct
91 Correct 925 ms 2008 KB Output is correct
92 Correct 938 ms 2008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 2132 KB Output is correct
2 Correct 311 ms 2012 KB Output is correct
3 Correct 202 ms 1884 KB Output is correct
4 Correct 325 ms 2008 KB Output is correct
5 Correct 339 ms 1884 KB Output is correct
6 Correct 305 ms 2384 KB Output is correct
7 Correct 181 ms 1880 KB Output is correct
8 Correct 186 ms 2136 KB Output is correct
9 Correct 245 ms 2024 KB Output is correct
10 Correct 276 ms 2024 KB Output is correct
11 Correct 96 ms 1884 KB Output is correct
12 Correct 309 ms 2008 KB Output is correct
13 Correct 204 ms 2008 KB Output is correct
14 Correct 324 ms 1884 KB Output is correct
15 Correct 341 ms 2004 KB Output is correct
16 Correct 303 ms 2028 KB Output is correct
17 Correct 183 ms 2004 KB Output is correct
18 Correct 188 ms 2132 KB Output is correct
19 Correct 242 ms 1884 KB Output is correct
20 Correct 270 ms 1884 KB Output is correct
21 Correct 287 ms 2480 KB Output is correct
22 Correct 286 ms 2284 KB Output is correct
23 Correct 586 ms 2264 KB Output is correct
24 Correct 405 ms 2128 KB Output is correct
25 Correct 578 ms 2476 KB Output is correct
26 Correct 647 ms 2484 KB Output is correct
27 Correct 584 ms 2384 KB Output is correct
28 Correct 517 ms 2476 KB Output is correct
29 Correct 89 ms 1880 KB Output is correct
30 Correct 328 ms 2004 KB Output is correct
31 Correct 203 ms 2136 KB Output is correct
32 Correct 326 ms 2132 KB Output is correct
33 Correct 339 ms 2008 KB Output is correct
34 Correct 305 ms 1880 KB Output is correct
35 Correct 200 ms 2004 KB Output is correct
36 Correct 185 ms 1880 KB Output is correct
37 Correct 364 ms 2008 KB Output is correct
38 Correct 291 ms 2012 KB Output is correct
39 Correct 284 ms 2480 KB Output is correct
40 Correct 288 ms 2264 KB Output is correct
41 Correct 645 ms 2268 KB Output is correct
42 Correct 410 ms 2016 KB Output is correct
43 Correct 675 ms 2404 KB Output is correct
44 Correct 677 ms 2488 KB Output is correct
45 Correct 583 ms 2484 KB Output is correct
46 Correct 514 ms 2356 KB Output is correct
47 Correct 573 ms 2464 KB Output is correct
48 Correct 565 ms 2568 KB Output is correct
49 Correct 1284 ms 2484 KB Output is correct
50 Correct 866 ms 2040 KB Output is correct
51 Correct 1334 ms 2744 KB Output is correct
52 Correct 1406 ms 2452 KB Output is correct
53 Correct 1170 ms 2712 KB Output is correct
54 Correct 1329 ms 2572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1880 KB Output is correct
2 Correct 27 ms 1884 KB Output is correct
3 Correct 13 ms 2020 KB Output is correct
4 Correct 91 ms 2000 KB Output is correct
5 Correct 854 ms 2132 KB Output is correct
6 Correct 875 ms 2024 KB Output is correct
7 Correct 522 ms 2012 KB Output is correct
8 Correct 885 ms 2008 KB Output is correct
9 Correct 1033 ms 2008 KB Output is correct
10 Correct 283 ms 2476 KB Output is correct
11 Correct 286 ms 2132 KB Output is correct
12 Correct 26 ms 1884 KB Output is correct
13 Correct 31 ms 1880 KB Output is correct
14 Correct 14 ms 2024 KB Output is correct
15 Correct 88 ms 1884 KB Output is correct
16 Correct 866 ms 2136 KB Output is correct
17 Correct 857 ms 2004 KB Output is correct
18 Correct 523 ms 1884 KB Output is correct
19 Correct 879 ms 1884 KB Output is correct
20 Correct 1036 ms 2016 KB Output is correct
21 Correct 285 ms 2476 KB Output is correct
22 Correct 285 ms 2392 KB Output is correct
23 Correct 1960 ms 2132 KB Output is correct
24 Correct 1941 ms 2012 KB Output is correct
25 Correct 1096 ms 2024 KB Output is correct
26 Correct 2397 ms 2020 KB Output is correct
27 Correct 2348 ms 2020 KB Output is correct
28 Correct 551 ms 2572 KB Output is correct
29 Correct 553 ms 2480 KB Output is correct
30 Correct 91 ms 2132 KB Output is correct
31 Correct 311 ms 2012 KB Output is correct
32 Correct 202 ms 1884 KB Output is correct
33 Correct 325 ms 2008 KB Output is correct
34 Correct 339 ms 1884 KB Output is correct
35 Correct 305 ms 2384 KB Output is correct
36 Correct 181 ms 1880 KB Output is correct
37 Correct 186 ms 2136 KB Output is correct
38 Correct 245 ms 2024 KB Output is correct
39 Correct 276 ms 2024 KB Output is correct
40 Correct 25 ms 2024 KB Output is correct
41 Correct 27 ms 1884 KB Output is correct
42 Correct 14 ms 1880 KB Output is correct
43 Correct 88 ms 2000 KB Output is correct
44 Correct 310 ms 1880 KB Output is correct
45 Correct 209 ms 2128 KB Output is correct
46 Correct 325 ms 2036 KB Output is correct
47 Correct 344 ms 2152 KB Output is correct
48 Correct 301 ms 2024 KB Output is correct
49 Correct 183 ms 2128 KB Output is correct
50 Correct 197 ms 2008 KB Output is correct
51 Correct 242 ms 2028 KB Output is correct
52 Correct 279 ms 2140 KB Output is correct
53 Correct 455 ms 2012 KB Output is correct
54 Correct 297 ms 2140 KB Output is correct
55 Correct 540 ms 2008 KB Output is correct
56 Correct 459 ms 1884 KB Output is correct
57 Correct 485 ms 2008 KB Output is correct
58 Correct 96 ms 1884 KB Output is correct
59 Correct 309 ms 2008 KB Output is correct
60 Correct 204 ms 2008 KB Output is correct
61 Correct 324 ms 1884 KB Output is correct
62 Correct 341 ms 2004 KB Output is correct
63 Correct 303 ms 2028 KB Output is correct
64 Correct 183 ms 2004 KB Output is correct
65 Correct 188 ms 2132 KB Output is correct
66 Correct 242 ms 1884 KB Output is correct
67 Correct 270 ms 1884 KB Output is correct
68 Correct 287 ms 2480 KB Output is correct
69 Correct 286 ms 2284 KB Output is correct
70 Correct 586 ms 2264 KB Output is correct
71 Correct 405 ms 2128 KB Output is correct
72 Correct 578 ms 2476 KB Output is correct
73 Correct 647 ms 2484 KB Output is correct
74 Correct 584 ms 2384 KB Output is correct
75 Correct 517 ms 2476 KB Output is correct
76 Correct 27 ms 1884 KB Output is correct
77 Correct 27 ms 1884 KB Output is correct
78 Correct 13 ms 1884 KB Output is correct
79 Correct 89 ms 1884 KB Output is correct
80 Correct 854 ms 2008 KB Output is correct
81 Correct 857 ms 2012 KB Output is correct
82 Correct 524 ms 2136 KB Output is correct
83 Correct 878 ms 1884 KB Output is correct
84 Correct 1058 ms 2020 KB Output is correct
85 Correct 289 ms 2360 KB Output is correct
86 Correct 292 ms 2268 KB Output is correct
87 Correct 314 ms 2132 KB Output is correct
88 Correct 203 ms 1884 KB Output is correct
89 Correct 330 ms 2016 KB Output is correct
90 Correct 338 ms 2020 KB Output is correct
91 Correct 309 ms 1884 KB Output is correct
92 Correct 181 ms 1884 KB Output is correct
93 Correct 183 ms 1880 KB Output is correct
94 Correct 241 ms 2020 KB Output is correct
95 Correct 290 ms 2008 KB Output is correct
96 Correct 467 ms 2008 KB Output is correct
97 Correct 290 ms 1880 KB Output is correct
98 Correct 527 ms 1884 KB Output is correct
99 Correct 471 ms 2012 KB Output is correct
100 Correct 485 ms 1884 KB Output is correct
101 Correct 592 ms 2268 KB Output is correct
102 Correct 411 ms 2008 KB Output is correct
103 Correct 592 ms 2360 KB Output is correct
104 Correct 661 ms 2480 KB Output is correct
105 Correct 588 ms 2384 KB Output is correct
106 Correct 528 ms 2472 KB Output is correct
107 Correct 901 ms 1884 KB Output is correct
108 Correct 1076 ms 2132 KB Output is correct
109 Correct 925 ms 2008 KB Output is correct
110 Correct 938 ms 2008 KB Output is correct
111 Correct 89 ms 1880 KB Output is correct
112 Correct 328 ms 2004 KB Output is correct
113 Correct 203 ms 2136 KB Output is correct
114 Correct 326 ms 2132 KB Output is correct
115 Correct 339 ms 2008 KB Output is correct
116 Correct 305 ms 1880 KB Output is correct
117 Correct 200 ms 2004 KB Output is correct
118 Correct 185 ms 1880 KB Output is correct
119 Correct 364 ms 2008 KB Output is correct
120 Correct 291 ms 2012 KB Output is correct
121 Correct 284 ms 2480 KB Output is correct
122 Correct 288 ms 2264 KB Output is correct
123 Correct 645 ms 2268 KB Output is correct
124 Correct 410 ms 2016 KB Output is correct
125 Correct 675 ms 2404 KB Output is correct
126 Correct 677 ms 2488 KB Output is correct
127 Correct 583 ms 2484 KB Output is correct
128 Correct 514 ms 2356 KB Output is correct
129 Correct 573 ms 2464 KB Output is correct
130 Correct 565 ms 2568 KB Output is correct
131 Correct 1284 ms 2484 KB Output is correct
132 Correct 866 ms 2040 KB Output is correct
133 Correct 1334 ms 2744 KB Output is correct
134 Correct 1406 ms 2452 KB Output is correct
135 Correct 1170 ms 2712 KB Output is correct
136 Correct 1329 ms 2572 KB Output is correct
137 Correct 53 ms 1884 KB Output is correct
138 Correct 32 ms 2008 KB Output is correct
139 Correct 13 ms 2032 KB Output is correct
140 Correct 88 ms 1884 KB Output is correct
141 Correct 870 ms 2020 KB Output is correct
142 Correct 853 ms 2016 KB Output is correct
143 Correct 539 ms 2008 KB Output is correct
144 Correct 943 ms 2008 KB Output is correct
145 Correct 1053 ms 2016 KB Output is correct
146 Correct 283 ms 2364 KB Output is correct
147 Correct 305 ms 2272 KB Output is correct
148 Correct 2072 ms 2020 KB Output is correct
149 Correct 1982 ms 2020 KB Output is correct
150 Correct 1121 ms 2020 KB Output is correct
151 Correct 2417 ms 1880 KB Output is correct
152 Correct 2507 ms 2020 KB Output is correct
153 Correct 590 ms 2460 KB Output is correct
154 Correct 562 ms 2464 KB Output is correct
155 Correct 322 ms 2012 KB Output is correct
156 Correct 208 ms 2012 KB Output is correct
157 Correct 352 ms 2268 KB Output is correct
158 Correct 363 ms 2008 KB Output is correct
159 Correct 341 ms 2028 KB Output is correct
160 Correct 187 ms 2012 KB Output is correct
161 Correct 184 ms 2012 KB Output is correct
162 Correct 254 ms 2012 KB Output is correct
163 Correct 386 ms 2028 KB Output is correct
164 Correct 599 ms 2268 KB Output is correct
165 Correct 415 ms 1884 KB Output is correct
166 Correct 596 ms 2480 KB Output is correct
167 Correct 706 ms 2364 KB Output is correct
168 Correct 588 ms 2408 KB Output is correct
169 Correct 537 ms 2360 KB Output is correct
170 Correct 461 ms 1880 KB Output is correct
171 Correct 291 ms 2012 KB Output is correct
172 Correct 555 ms 2016 KB Output is correct
173 Correct 504 ms 2012 KB Output is correct
174 Correct 510 ms 2016 KB Output is correct
175 Correct 908 ms 1884 KB Output is correct
176 Correct 1242 ms 2020 KB Output is correct
177 Correct 942 ms 2020 KB Output is correct
178 Correct 944 ms 2020 KB Output is correct
179 Correct 1334 ms 2460 KB Output is correct
180 Correct 999 ms 2028 KB Output is correct
181 Correct 1320 ms 2464 KB Output is correct
182 Correct 1490 ms 2556 KB Output is correct
183 Correct 1246 ms 2556 KB Output is correct
184 Correct 1233 ms 2468 KB Output is correct
185 Correct 2058 ms 2024 KB Output is correct
186 Correct 2475 ms 2024 KB Output is correct
187 Correct 2266 ms 2020 KB Output is correct
188 Correct 2126 ms 2028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 2132 KB Output is correct
2 Correct 311 ms 2012 KB Output is correct
3 Correct 202 ms 1884 KB Output is correct
4 Correct 325 ms 2008 KB Output is correct
5 Correct 339 ms 1884 KB Output is correct
6 Correct 305 ms 2384 KB Output is correct
7 Correct 181 ms 1880 KB Output is correct
8 Correct 186 ms 2136 KB Output is correct
9 Correct 245 ms 2024 KB Output is correct
10 Correct 276 ms 2024 KB Output is correct
11 Correct 96 ms 1884 KB Output is correct
12 Correct 309 ms 2008 KB Output is correct
13 Correct 204 ms 2008 KB Output is correct
14 Correct 324 ms 1884 KB Output is correct
15 Correct 341 ms 2004 KB Output is correct
16 Correct 303 ms 2028 KB Output is correct
17 Correct 183 ms 2004 KB Output is correct
18 Correct 188 ms 2132 KB Output is correct
19 Correct 242 ms 1884 KB Output is correct
20 Correct 270 ms 1884 KB Output is correct
21 Correct 287 ms 2480 KB Output is correct
22 Correct 286 ms 2284 KB Output is correct
23 Correct 586 ms 2264 KB Output is correct
24 Correct 405 ms 2128 KB Output is correct
25 Correct 578 ms 2476 KB Output is correct
26 Correct 647 ms 2484 KB Output is correct
27 Correct 584 ms 2384 KB Output is correct
28 Correct 517 ms 2476 KB Output is correct
29 Correct 89 ms 1880 KB Output is correct
30 Correct 328 ms 2004 KB Output is correct
31 Correct 203 ms 2136 KB Output is correct
32 Correct 326 ms 2132 KB Output is correct
33 Correct 339 ms 2008 KB Output is correct
34 Correct 305 ms 1880 KB Output is correct
35 Correct 200 ms 2004 KB Output is correct
36 Correct 185 ms 1880 KB Output is correct
37 Correct 364 ms 2008 KB Output is correct
38 Correct 291 ms 2012 KB Output is correct
39 Correct 284 ms 2480 KB Output is correct
40 Correct 288 ms 2264 KB Output is correct
41 Correct 645 ms 2268 KB Output is correct
42 Correct 410 ms 2016 KB Output is correct
43 Correct 675 ms 2404 KB Output is correct
44 Correct 677 ms 2488 KB Output is correct
45 Correct 583 ms 2484 KB Output is correct
46 Correct 514 ms 2356 KB Output is correct
47 Correct 573 ms 2464 KB Output is correct
48 Correct 565 ms 2568 KB Output is correct
49 Correct 1284 ms 2484 KB Output is correct
50 Correct 866 ms 2040 KB Output is correct
51 Correct 1334 ms 2744 KB Output is correct
52 Correct 1406 ms 2452 KB Output is correct
53 Correct 1170 ms 2712 KB Output is correct
54 Correct 1329 ms 2572 KB Output is correct
55 Correct 89 ms 1884 KB Output is correct
56 Correct 312 ms 2012 KB Output is correct
57 Correct 243 ms 2008 KB Output is correct
58 Correct 332 ms 2024 KB Output is correct
59 Correct 355 ms 2004 KB Output is correct
60 Correct 309 ms 1880 KB Output is correct
61 Correct 207 ms 2024 KB Output is correct
62 Correct 185 ms 1884 KB Output is correct
63 Correct 257 ms 2008 KB Output is correct
64 Correct 275 ms 2024 KB Output is correct
65 Correct 297 ms 2364 KB Output is correct
66 Correct 287 ms 2272 KB Output is correct
67 Correct 593 ms 2284 KB Output is correct
68 Correct 477 ms 2016 KB Output is correct
69 Correct 583 ms 2492 KB Output is correct
70 Correct 659 ms 2484 KB Output is correct
71 Correct 624 ms 2392 KB Output is correct
72 Correct 526 ms 2360 KB Output is correct
73 Correct 562 ms 2620 KB Output is correct
74 Correct 578 ms 2460 KB Output is correct
75 Correct 1314 ms 2456 KB Output is correct
76 Correct 909 ms 2024 KB Output is correct
77 Correct 1371 ms 2828 KB Output is correct
78 Correct 1430 ms 2480 KB Output is correct
79 Correct 1142 ms 2572 KB Output is correct
80 Correct 1206 ms 2468 KB Output is correct
81 Correct 4741 ms 4296 KB Output is correct
82 Correct 2984 ms 2060 KB Output is correct
83 Correct 4624 ms 5520 KB Output is correct
84 Execution timed out 5044 ms 4268 KB Time limit exceeded
85 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1880 KB Output is correct
2 Correct 27 ms 1884 KB Output is correct
3 Correct 13 ms 2020 KB Output is correct
4 Correct 91 ms 2000 KB Output is correct
5 Correct 854 ms 2132 KB Output is correct
6 Correct 875 ms 2024 KB Output is correct
7 Correct 522 ms 2012 KB Output is correct
8 Correct 885 ms 2008 KB Output is correct
9 Correct 1033 ms 2008 KB Output is correct
10 Correct 283 ms 2476 KB Output is correct
11 Correct 286 ms 2132 KB Output is correct
12 Correct 26 ms 1884 KB Output is correct
13 Correct 31 ms 1880 KB Output is correct
14 Correct 14 ms 2024 KB Output is correct
15 Correct 88 ms 1884 KB Output is correct
16 Correct 866 ms 2136 KB Output is correct
17 Correct 857 ms 2004 KB Output is correct
18 Correct 523 ms 1884 KB Output is correct
19 Correct 879 ms 1884 KB Output is correct
20 Correct 1036 ms 2016 KB Output is correct
21 Correct 285 ms 2476 KB Output is correct
22 Correct 285 ms 2392 KB Output is correct
23 Correct 1960 ms 2132 KB Output is correct
24 Correct 1941 ms 2012 KB Output is correct
25 Correct 1096 ms 2024 KB Output is correct
26 Correct 2397 ms 2020 KB Output is correct
27 Correct 2348 ms 2020 KB Output is correct
28 Correct 551 ms 2572 KB Output is correct
29 Correct 553 ms 2480 KB Output is correct
30 Correct 91 ms 2132 KB Output is correct
31 Correct 311 ms 2012 KB Output is correct
32 Correct 202 ms 1884 KB Output is correct
33 Correct 325 ms 2008 KB Output is correct
34 Correct 339 ms 1884 KB Output is correct
35 Correct 305 ms 2384 KB Output is correct
36 Correct 181 ms 1880 KB Output is correct
37 Correct 186 ms 2136 KB Output is correct
38 Correct 245 ms 2024 KB Output is correct
39 Correct 276 ms 2024 KB Output is correct
40 Correct 25 ms 2024 KB Output is correct
41 Correct 27 ms 1884 KB Output is correct
42 Correct 14 ms 1880 KB Output is correct
43 Correct 88 ms 2000 KB Output is correct
44 Correct 310 ms 1880 KB Output is correct
45 Correct 209 ms 2128 KB Output is correct
46 Correct 325 ms 2036 KB Output is correct
47 Correct 344 ms 2152 KB Output is correct
48 Correct 301 ms 2024 KB Output is correct
49 Correct 183 ms 2128 KB Output is correct
50 Correct 197 ms 2008 KB Output is correct
51 Correct 242 ms 2028 KB Output is correct
52 Correct 279 ms 2140 KB Output is correct
53 Correct 455 ms 2012 KB Output is correct
54 Correct 297 ms 2140 KB Output is correct
55 Correct 540 ms 2008 KB Output is correct
56 Correct 459 ms 1884 KB Output is correct
57 Correct 485 ms 2008 KB Output is correct
58 Correct 96 ms 1884 KB Output is correct
59 Correct 309 ms 2008 KB Output is correct
60 Correct 204 ms 2008 KB Output is correct
61 Correct 324 ms 1884 KB Output is correct
62 Correct 341 ms 2004 KB Output is correct
63 Correct 303 ms 2028 KB Output is correct
64 Correct 183 ms 2004 KB Output is correct
65 Correct 188 ms 2132 KB Output is correct
66 Correct 242 ms 1884 KB Output is correct
67 Correct 270 ms 1884 KB Output is correct
68 Correct 287 ms 2480 KB Output is correct
69 Correct 286 ms 2284 KB Output is correct
70 Correct 586 ms 2264 KB Output is correct
71 Correct 405 ms 2128 KB Output is correct
72 Correct 578 ms 2476 KB Output is correct
73 Correct 647 ms 2484 KB Output is correct
74 Correct 584 ms 2384 KB Output is correct
75 Correct 517 ms 2476 KB Output is correct
76 Correct 27 ms 1884 KB Output is correct
77 Correct 27 ms 1884 KB Output is correct
78 Correct 13 ms 1884 KB Output is correct
79 Correct 89 ms 1884 KB Output is correct
80 Correct 854 ms 2008 KB Output is correct
81 Correct 857 ms 2012 KB Output is correct
82 Correct 524 ms 2136 KB Output is correct
83 Correct 878 ms 1884 KB Output is correct
84 Correct 1058 ms 2020 KB Output is correct
85 Correct 289 ms 2360 KB Output is correct
86 Correct 292 ms 2268 KB Output is correct
87 Correct 314 ms 2132 KB Output is correct
88 Correct 203 ms 1884 KB Output is correct
89 Correct 330 ms 2016 KB Output is correct
90 Correct 338 ms 2020 KB Output is correct
91 Correct 309 ms 1884 KB Output is correct
92 Correct 181 ms 1884 KB Output is correct
93 Correct 183 ms 1880 KB Output is correct
94 Correct 241 ms 2020 KB Output is correct
95 Correct 290 ms 2008 KB Output is correct
96 Correct 467 ms 2008 KB Output is correct
97 Correct 290 ms 1880 KB Output is correct
98 Correct 527 ms 1884 KB Output is correct
99 Correct 471 ms 2012 KB Output is correct
100 Correct 485 ms 1884 KB Output is correct
101 Correct 592 ms 2268 KB Output is correct
102 Correct 411 ms 2008 KB Output is correct
103 Correct 592 ms 2360 KB Output is correct
104 Correct 661 ms 2480 KB Output is correct
105 Correct 588 ms 2384 KB Output is correct
106 Correct 528 ms 2472 KB Output is correct
107 Correct 901 ms 1884 KB Output is correct
108 Correct 1076 ms 2132 KB Output is correct
109 Correct 925 ms 2008 KB Output is correct
110 Correct 938 ms 2008 KB Output is correct
111 Correct 89 ms 1880 KB Output is correct
112 Correct 328 ms 2004 KB Output is correct
113 Correct 203 ms 2136 KB Output is correct
114 Correct 326 ms 2132 KB Output is correct
115 Correct 339 ms 2008 KB Output is correct
116 Correct 305 ms 1880 KB Output is correct
117 Correct 200 ms 2004 KB Output is correct
118 Correct 185 ms 1880 KB Output is correct
119 Correct 364 ms 2008 KB Output is correct
120 Correct 291 ms 2012 KB Output is correct
121 Correct 284 ms 2480 KB Output is correct
122 Correct 288 ms 2264 KB Output is correct
123 Correct 645 ms 2268 KB Output is correct
124 Correct 410 ms 2016 KB Output is correct
125 Correct 675 ms 2404 KB Output is correct
126 Correct 677 ms 2488 KB Output is correct
127 Correct 583 ms 2484 KB Output is correct
128 Correct 514 ms 2356 KB Output is correct
129 Correct 573 ms 2464 KB Output is correct
130 Correct 565 ms 2568 KB Output is correct
131 Correct 1284 ms 2484 KB Output is correct
132 Correct 866 ms 2040 KB Output is correct
133 Correct 1334 ms 2744 KB Output is correct
134 Correct 1406 ms 2452 KB Output is correct
135 Correct 1170 ms 2712 KB Output is correct
136 Correct 1329 ms 2572 KB Output is correct
137 Correct 53 ms 1884 KB Output is correct
138 Correct 32 ms 2008 KB Output is correct
139 Correct 13 ms 2032 KB Output is correct
140 Correct 88 ms 1884 KB Output is correct
141 Correct 870 ms 2020 KB Output is correct
142 Correct 853 ms 2016 KB Output is correct
143 Correct 539 ms 2008 KB Output is correct
144 Correct 943 ms 2008 KB Output is correct
145 Correct 1053 ms 2016 KB Output is correct
146 Correct 283 ms 2364 KB Output is correct
147 Correct 305 ms 2272 KB Output is correct
148 Correct 2072 ms 2020 KB Output is correct
149 Correct 1982 ms 2020 KB Output is correct
150 Correct 1121 ms 2020 KB Output is correct
151 Correct 2417 ms 1880 KB Output is correct
152 Correct 2507 ms 2020 KB Output is correct
153 Correct 590 ms 2460 KB Output is correct
154 Correct 562 ms 2464 KB Output is correct
155 Correct 322 ms 2012 KB Output is correct
156 Correct 208 ms 2012 KB Output is correct
157 Correct 352 ms 2268 KB Output is correct
158 Correct 363 ms 2008 KB Output is correct
159 Correct 341 ms 2028 KB Output is correct
160 Correct 187 ms 2012 KB Output is correct
161 Correct 184 ms 2012 KB Output is correct
162 Correct 254 ms 2012 KB Output is correct
163 Correct 386 ms 2028 KB Output is correct
164 Correct 599 ms 2268 KB Output is correct
165 Correct 415 ms 1884 KB Output is correct
166 Correct 596 ms 2480 KB Output is correct
167 Correct 706 ms 2364 KB Output is correct
168 Correct 588 ms 2408 KB Output is correct
169 Correct 537 ms 2360 KB Output is correct
170 Correct 461 ms 1880 KB Output is correct
171 Correct 291 ms 2012 KB Output is correct
172 Correct 555 ms 2016 KB Output is correct
173 Correct 504 ms 2012 KB Output is correct
174 Correct 510 ms 2016 KB Output is correct
175 Correct 908 ms 1884 KB Output is correct
176 Correct 1242 ms 2020 KB Output is correct
177 Correct 942 ms 2020 KB Output is correct
178 Correct 944 ms 2020 KB Output is correct
179 Correct 1334 ms 2460 KB Output is correct
180 Correct 999 ms 2028 KB Output is correct
181 Correct 1320 ms 2464 KB Output is correct
182 Correct 1490 ms 2556 KB Output is correct
183 Correct 1246 ms 2556 KB Output is correct
184 Correct 1233 ms 2468 KB Output is correct
185 Correct 2058 ms 2024 KB Output is correct
186 Correct 2475 ms 2024 KB Output is correct
187 Correct 2266 ms 2020 KB Output is correct
188 Correct 2126 ms 2028 KB Output is correct
189 Correct 89 ms 1884 KB Output is correct
190 Correct 312 ms 2012 KB Output is correct
191 Correct 243 ms 2008 KB Output is correct
192 Correct 332 ms 2024 KB Output is correct
193 Correct 355 ms 2004 KB Output is correct
194 Correct 309 ms 1880 KB Output is correct
195 Correct 207 ms 2024 KB Output is correct
196 Correct 185 ms 1884 KB Output is correct
197 Correct 257 ms 2008 KB Output is correct
198 Correct 275 ms 2024 KB Output is correct
199 Correct 297 ms 2364 KB Output is correct
200 Correct 287 ms 2272 KB Output is correct
201 Correct 593 ms 2284 KB Output is correct
202 Correct 477 ms 2016 KB Output is correct
203 Correct 583 ms 2492 KB Output is correct
204 Correct 659 ms 2484 KB Output is correct
205 Correct 624 ms 2392 KB Output is correct
206 Correct 526 ms 2360 KB Output is correct
207 Correct 562 ms 2620 KB Output is correct
208 Correct 578 ms 2460 KB Output is correct
209 Correct 1314 ms 2456 KB Output is correct
210 Correct 909 ms 2024 KB Output is correct
211 Correct 1371 ms 2828 KB Output is correct
212 Correct 1430 ms 2480 KB Output is correct
213 Correct 1142 ms 2572 KB Output is correct
214 Correct 1206 ms 2468 KB Output is correct
215 Correct 4741 ms 4296 KB Output is correct
216 Correct 2984 ms 2060 KB Output is correct
217 Correct 4624 ms 5520 KB Output is correct
218 Execution timed out 5044 ms 4268 KB Time limit exceeded
219 Halted 0 ms 0 KB -