Submission #579251

# Submission time Handle Problem Language Result Execution time Memory
579251 2022-06-18T16:00:18 Z cheissmart Uplifting Excursion (BOI22_vault) C++14
100 / 100
2041 ms 4716 KB
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

string _reset = "\u001b[0m", _yellow = "\u001b[33m", _bold = "\u001b[1m";
void DBG() { cerr << "]" << _reset << endl; }
template<class H, class...T> void DBG(H h, T ...t) {
	cerr << to_string(h);
	if(sizeof ...(t)) cerr << ", ";
	DBG(t...);
}
#ifdef CHEISSMART
#define debug(...) cerr << _yellow << _bold << "Line(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define debug(...)
#endif

const int INF = 1e9 + 7, mxM = 303;

template<class T> void cmax(T& a, T b) { a = max(a, b); }

int m;
ll a[mxM * 2], b[mxM * 2], l;

signed main()
{
	IO_OP;

	cin >> m >> l;
	ll tot = 0, ans = 0;
	for(int i = -m; i <= m; i++) {
		cin >> a[i + m];
		tot += a[i + m] * i;
	}
	if(tot < l) {
		tot = -tot;
		l = -l;
		for(int i = 0; i < m; i++)
			swap(a[i], a[2 * m - i]);
	}
	tot = 0;
	for(int i = -m; i <= 0; i++) {
		tot += a[i + m] * i;
		b[i + m] = a[i + m];
		ans += b[i + m];
	}

	if(tot > l) {
		cout << "impossible\n";
		return 0;
	}
	for(int i = 1; i <= m; i++) {
		assert(tot <= l);
		b[i + m] = min((l - tot) / i, a[i + m]);
		tot += b[i + m] * i;
		ans += b[i + m];
	}
	assert(tot <= l);
	assert(tot + mxM >= l);

	int C = mxM * mxM;
	vi dp(C * 2, -INF);
	dp[0 + C] = 0;

	for(int i = -m; i <= m; i++) {
		if(i == 0) continue;
		vi ndp(C * 2, -INF);
		ll lb = b[i + m] - a[i + m], rb = b[i + m];
		auto go = [&] (vi pos) {
			deque<pi> dk;
			auto add = [&] (int x, int y) {
				while(SZ(dk) && dk.back().F <= x) dk.pop_back();
				dk.EB(x, y);
			};
			for(int k = 0, kk = 0; k < SZ(pos); k++) {
				while(kk < SZ(pos) && kk <= k + rb) {
					add(dp[pos[kk]] - kk, kk);
					kk++;
				}
				while(dk[0].S < k + lb)
					dk.pop_front();
				ndp[pos[k]] = dk[0].F + k;
			}
		};
		if(i > 0) {
			for(int j = 0; j < i; j++) {
				vi pos;
				for(int k = j; k < 2 * C; k += i)
					pos.PB(k);
				go(pos);
			}
		} else {
			for(int j = 0; j < -i; j++) {
				vi pos;
				for(int k = j; k < 2 * C; k -= i)
					pos.PB(k);
				reverse(ALL(pos));
				go(pos);	
			}
		}
		swap(dp, ndp);
	}
	if(dp[l - tot + C] < -1e8) cout << "impossible\n";
	else cout << ans + dp[l - tot + C] << '\n';


}

# Verdict Execution time Memory Grader output
1 Correct 16 ms 3532 KB Output is correct
2 Correct 22 ms 3540 KB Output is correct
3 Correct 9 ms 3424 KB Output is correct
4 Correct 71 ms 3448 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 356 ms 3472 KB Output is correct
7 Correct 360 ms 3484 KB Output is correct
8 Correct 339 ms 3444 KB Output is correct
9 Correct 369 ms 3540 KB Output is correct
10 Correct 348 ms 3428 KB Output is correct
11 Correct 353 ms 3588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 3532 KB Output is correct
2 Correct 22 ms 3540 KB Output is correct
3 Correct 9 ms 3424 KB Output is correct
4 Correct 71 ms 3448 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 356 ms 3472 KB Output is correct
7 Correct 360 ms 3484 KB Output is correct
8 Correct 339 ms 3444 KB Output is correct
9 Correct 369 ms 3540 KB Output is correct
10 Correct 348 ms 3428 KB Output is correct
11 Correct 353 ms 3588 KB Output is correct
12 Correct 17 ms 3528 KB Output is correct
13 Correct 23 ms 3488 KB Output is correct
14 Correct 9 ms 3424 KB Output is correct
15 Correct 69 ms 3444 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 371 ms 3460 KB Output is correct
18 Correct 342 ms 3432 KB Output is correct
19 Correct 375 ms 3464 KB Output is correct
20 Correct 365 ms 3468 KB Output is correct
21 Correct 329 ms 3444 KB Output is correct
22 Correct 356 ms 3464 KB Output is correct
23 Correct 1 ms 232 KB Output is correct
24 Correct 720 ms 3444 KB Output is correct
25 Correct 695 ms 3488 KB Output is correct
26 Correct 718 ms 3464 KB Output is correct
27 Correct 723 ms 3456 KB Output is correct
28 Correct 675 ms 3484 KB Output is correct
29 Correct 688 ms 3484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 3548 KB Output is correct
2 Correct 210 ms 3492 KB Output is correct
3 Correct 216 ms 3480 KB Output is correct
4 Correct 206 ms 3484 KB Output is correct
5 Correct 226 ms 3516 KB Output is correct
6 Correct 209 ms 3960 KB Output is correct
7 Correct 203 ms 3492 KB Output is correct
8 Correct 228 ms 3512 KB Output is correct
9 Correct 229 ms 3956 KB Output is correct
10 Correct 200 ms 3552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 3548 KB Output is correct
2 Correct 210 ms 3492 KB Output is correct
3 Correct 216 ms 3480 KB Output is correct
4 Correct 206 ms 3484 KB Output is correct
5 Correct 226 ms 3516 KB Output is correct
6 Correct 209 ms 3960 KB Output is correct
7 Correct 203 ms 3492 KB Output is correct
8 Correct 228 ms 3512 KB Output is correct
9 Correct 229 ms 3956 KB Output is correct
10 Correct 200 ms 3552 KB Output is correct
11 Correct 16 ms 3532 KB Output is correct
12 Correct 23 ms 3524 KB Output is correct
13 Correct 11 ms 3424 KB Output is correct
14 Correct 79 ms 3452 KB Output is correct
15 Correct 198 ms 3448 KB Output is correct
16 Correct 203 ms 3488 KB Output is correct
17 Correct 217 ms 3436 KB Output is correct
18 Correct 198 ms 3516 KB Output is correct
19 Correct 215 ms 4092 KB Output is correct
20 Correct 213 ms 3460 KB Output is correct
21 Correct 205 ms 3444 KB Output is correct
22 Correct 212 ms 3956 KB Output is correct
23 Correct 213 ms 3576 KB Output is correct
24 Correct 208 ms 3588 KB Output is correct
25 Correct 213 ms 3504 KB Output is correct
26 Correct 202 ms 3484 KB Output is correct
27 Correct 199 ms 3476 KB Output is correct
28 Correct 218 ms 3896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 3548 KB Output is correct
2 Correct 210 ms 3492 KB Output is correct
3 Correct 216 ms 3480 KB Output is correct
4 Correct 206 ms 3484 KB Output is correct
5 Correct 226 ms 3516 KB Output is correct
6 Correct 209 ms 3960 KB Output is correct
7 Correct 203 ms 3492 KB Output is correct
8 Correct 228 ms 3512 KB Output is correct
9 Correct 229 ms 3956 KB Output is correct
10 Correct 200 ms 3552 KB Output is correct
11 Correct 70 ms 3464 KB Output is correct
12 Correct 201 ms 3448 KB Output is correct
13 Correct 209 ms 3452 KB Output is correct
14 Correct 204 ms 3436 KB Output is correct
15 Correct 212 ms 3476 KB Output is correct
16 Correct 199 ms 3916 KB Output is correct
17 Correct 197 ms 3440 KB Output is correct
18 Correct 212 ms 3484 KB Output is correct
19 Correct 198 ms 3952 KB Output is correct
20 Correct 214 ms 3444 KB Output is correct
21 Correct 343 ms 3464 KB Output is correct
22 Correct 360 ms 3504 KB Output is correct
23 Correct 355 ms 3452 KB Output is correct
24 Correct 332 ms 3504 KB Output is correct
25 Correct 358 ms 4040 KB Output is correct
26 Correct 347 ms 3468 KB Output is correct
27 Correct 349 ms 3904 KB Output is correct
28 Correct 333 ms 3488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 3532 KB Output is correct
2 Correct 22 ms 3540 KB Output is correct
3 Correct 9 ms 3424 KB Output is correct
4 Correct 71 ms 3448 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 356 ms 3472 KB Output is correct
7 Correct 360 ms 3484 KB Output is correct
8 Correct 339 ms 3444 KB Output is correct
9 Correct 369 ms 3540 KB Output is correct
10 Correct 348 ms 3428 KB Output is correct
11 Correct 353 ms 3588 KB Output is correct
12 Correct 69 ms 3548 KB Output is correct
13 Correct 210 ms 3492 KB Output is correct
14 Correct 216 ms 3480 KB Output is correct
15 Correct 206 ms 3484 KB Output is correct
16 Correct 226 ms 3516 KB Output is correct
17 Correct 209 ms 3960 KB Output is correct
18 Correct 203 ms 3492 KB Output is correct
19 Correct 228 ms 3512 KB Output is correct
20 Correct 229 ms 3956 KB Output is correct
21 Correct 200 ms 3552 KB Output is correct
22 Correct 16 ms 3532 KB Output is correct
23 Correct 23 ms 3524 KB Output is correct
24 Correct 11 ms 3424 KB Output is correct
25 Correct 79 ms 3452 KB Output is correct
26 Correct 198 ms 3448 KB Output is correct
27 Correct 203 ms 3488 KB Output is correct
28 Correct 217 ms 3436 KB Output is correct
29 Correct 198 ms 3516 KB Output is correct
30 Correct 215 ms 4092 KB Output is correct
31 Correct 213 ms 3460 KB Output is correct
32 Correct 205 ms 3444 KB Output is correct
33 Correct 212 ms 3956 KB Output is correct
34 Correct 213 ms 3576 KB Output is correct
35 Correct 208 ms 3588 KB Output is correct
36 Correct 213 ms 3504 KB Output is correct
37 Correct 202 ms 3484 KB Output is correct
38 Correct 199 ms 3476 KB Output is correct
39 Correct 218 ms 3896 KB Output is correct
40 Correct 70 ms 3464 KB Output is correct
41 Correct 201 ms 3448 KB Output is correct
42 Correct 209 ms 3452 KB Output is correct
43 Correct 204 ms 3436 KB Output is correct
44 Correct 212 ms 3476 KB Output is correct
45 Correct 199 ms 3916 KB Output is correct
46 Correct 197 ms 3440 KB Output is correct
47 Correct 212 ms 3484 KB Output is correct
48 Correct 198 ms 3952 KB Output is correct
49 Correct 214 ms 3444 KB Output is correct
50 Correct 343 ms 3464 KB Output is correct
51 Correct 360 ms 3504 KB Output is correct
52 Correct 355 ms 3452 KB Output is correct
53 Correct 332 ms 3504 KB Output is correct
54 Correct 358 ms 4040 KB Output is correct
55 Correct 347 ms 3468 KB Output is correct
56 Correct 349 ms 3904 KB Output is correct
57 Correct 333 ms 3488 KB Output is correct
58 Correct 16 ms 3480 KB Output is correct
59 Correct 29 ms 3456 KB Output is correct
60 Correct 10 ms 3424 KB Output is correct
61 Correct 72 ms 3504 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 338 ms 3488 KB Output is correct
64 Correct 357 ms 3484 KB Output is correct
65 Correct 334 ms 3468 KB Output is correct
66 Correct 359 ms 3484 KB Output is correct
67 Correct 349 ms 3436 KB Output is correct
68 Correct 359 ms 3552 KB Output is correct
69 Correct 201 ms 3440 KB Output is correct
70 Correct 234 ms 3444 KB Output is correct
71 Correct 203 ms 3428 KB Output is correct
72 Correct 208 ms 3484 KB Output is correct
73 Correct 199 ms 3944 KB Output is correct
74 Correct 220 ms 3476 KB Output is correct
75 Correct 204 ms 3476 KB Output is correct
76 Correct 205 ms 3960 KB Output is correct
77 Correct 209 ms 3440 KB Output is correct
78 Correct 220 ms 3472 KB Output is correct
79 Correct 210 ms 3472 KB Output is correct
80 Correct 210 ms 3584 KB Output is correct
81 Correct 212 ms 3464 KB Output is correct
82 Correct 204 ms 3904 KB Output is correct
83 Correct 334 ms 3472 KB Output is correct
84 Correct 345 ms 3440 KB Output is correct
85 Correct 364 ms 3912 KB Output is correct
86 Correct 338 ms 3484 KB Output is correct
87 Correct 353 ms 3956 KB Output is correct
88 Correct 371 ms 3468 KB Output is correct
89 Correct 342 ms 3464 KB Output is correct
90 Correct 361 ms 4684 KB Output is correct
91 Correct 324 ms 3952 KB Output is correct
92 Correct 360 ms 4676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 3548 KB Output is correct
2 Correct 210 ms 3492 KB Output is correct
3 Correct 216 ms 3480 KB Output is correct
4 Correct 206 ms 3484 KB Output is correct
5 Correct 226 ms 3516 KB Output is correct
6 Correct 209 ms 3960 KB Output is correct
7 Correct 203 ms 3492 KB Output is correct
8 Correct 228 ms 3512 KB Output is correct
9 Correct 229 ms 3956 KB Output is correct
10 Correct 200 ms 3552 KB Output is correct
11 Correct 70 ms 3464 KB Output is correct
12 Correct 201 ms 3448 KB Output is correct
13 Correct 209 ms 3452 KB Output is correct
14 Correct 204 ms 3436 KB Output is correct
15 Correct 212 ms 3476 KB Output is correct
16 Correct 199 ms 3916 KB Output is correct
17 Correct 197 ms 3440 KB Output is correct
18 Correct 212 ms 3484 KB Output is correct
19 Correct 198 ms 3952 KB Output is correct
20 Correct 214 ms 3444 KB Output is correct
21 Correct 343 ms 3464 KB Output is correct
22 Correct 360 ms 3504 KB Output is correct
23 Correct 355 ms 3452 KB Output is correct
24 Correct 332 ms 3504 KB Output is correct
25 Correct 358 ms 4040 KB Output is correct
26 Correct 347 ms 3468 KB Output is correct
27 Correct 349 ms 3904 KB Output is correct
28 Correct 333 ms 3488 KB Output is correct
29 Correct 68 ms 3508 KB Output is correct
30 Correct 205 ms 3520 KB Output is correct
31 Correct 218 ms 3476 KB Output is correct
32 Correct 204 ms 3488 KB Output is correct
33 Correct 210 ms 3432 KB Output is correct
34 Correct 205 ms 3960 KB Output is correct
35 Correct 216 ms 3440 KB Output is correct
36 Correct 205 ms 3456 KB Output is correct
37 Correct 207 ms 3960 KB Output is correct
38 Correct 230 ms 3440 KB Output is correct
39 Correct 359 ms 3480 KB Output is correct
40 Correct 367 ms 3476 KB Output is correct
41 Correct 338 ms 3460 KB Output is correct
42 Correct 339 ms 3508 KB Output is correct
43 Correct 338 ms 4024 KB Output is correct
44 Correct 335 ms 3484 KB Output is correct
45 Correct 360 ms 3948 KB Output is correct
46 Correct 336 ms 3432 KB Output is correct
47 Correct 646 ms 3484 KB Output is correct
48 Correct 674 ms 3440 KB Output is correct
49 Correct 662 ms 3948 KB Output is correct
50 Correct 685 ms 3424 KB Output is correct
51 Correct 681 ms 3948 KB Output is correct
52 Correct 702 ms 3672 KB Output is correct
53 Correct 708 ms 4068 KB Output is correct
54 Correct 710 ms 3500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 3532 KB Output is correct
2 Correct 22 ms 3540 KB Output is correct
3 Correct 9 ms 3424 KB Output is correct
4 Correct 71 ms 3448 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 356 ms 3472 KB Output is correct
7 Correct 360 ms 3484 KB Output is correct
8 Correct 339 ms 3444 KB Output is correct
9 Correct 369 ms 3540 KB Output is correct
10 Correct 348 ms 3428 KB Output is correct
11 Correct 353 ms 3588 KB Output is correct
12 Correct 17 ms 3528 KB Output is correct
13 Correct 23 ms 3488 KB Output is correct
14 Correct 9 ms 3424 KB Output is correct
15 Correct 69 ms 3444 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 371 ms 3460 KB Output is correct
18 Correct 342 ms 3432 KB Output is correct
19 Correct 375 ms 3464 KB Output is correct
20 Correct 365 ms 3468 KB Output is correct
21 Correct 329 ms 3444 KB Output is correct
22 Correct 356 ms 3464 KB Output is correct
23 Correct 1 ms 232 KB Output is correct
24 Correct 720 ms 3444 KB Output is correct
25 Correct 695 ms 3488 KB Output is correct
26 Correct 718 ms 3464 KB Output is correct
27 Correct 723 ms 3456 KB Output is correct
28 Correct 675 ms 3484 KB Output is correct
29 Correct 688 ms 3484 KB Output is correct
30 Correct 69 ms 3548 KB Output is correct
31 Correct 210 ms 3492 KB Output is correct
32 Correct 216 ms 3480 KB Output is correct
33 Correct 206 ms 3484 KB Output is correct
34 Correct 226 ms 3516 KB Output is correct
35 Correct 209 ms 3960 KB Output is correct
36 Correct 203 ms 3492 KB Output is correct
37 Correct 228 ms 3512 KB Output is correct
38 Correct 229 ms 3956 KB Output is correct
39 Correct 200 ms 3552 KB Output is correct
40 Correct 16 ms 3532 KB Output is correct
41 Correct 23 ms 3524 KB Output is correct
42 Correct 11 ms 3424 KB Output is correct
43 Correct 79 ms 3452 KB Output is correct
44 Correct 198 ms 3448 KB Output is correct
45 Correct 203 ms 3488 KB Output is correct
46 Correct 217 ms 3436 KB Output is correct
47 Correct 198 ms 3516 KB Output is correct
48 Correct 215 ms 4092 KB Output is correct
49 Correct 213 ms 3460 KB Output is correct
50 Correct 205 ms 3444 KB Output is correct
51 Correct 212 ms 3956 KB Output is correct
52 Correct 213 ms 3576 KB Output is correct
53 Correct 208 ms 3588 KB Output is correct
54 Correct 213 ms 3504 KB Output is correct
55 Correct 202 ms 3484 KB Output is correct
56 Correct 199 ms 3476 KB Output is correct
57 Correct 218 ms 3896 KB Output is correct
58 Correct 70 ms 3464 KB Output is correct
59 Correct 201 ms 3448 KB Output is correct
60 Correct 209 ms 3452 KB Output is correct
61 Correct 204 ms 3436 KB Output is correct
62 Correct 212 ms 3476 KB Output is correct
63 Correct 199 ms 3916 KB Output is correct
64 Correct 197 ms 3440 KB Output is correct
65 Correct 212 ms 3484 KB Output is correct
66 Correct 198 ms 3952 KB Output is correct
67 Correct 214 ms 3444 KB Output is correct
68 Correct 343 ms 3464 KB Output is correct
69 Correct 360 ms 3504 KB Output is correct
70 Correct 355 ms 3452 KB Output is correct
71 Correct 332 ms 3504 KB Output is correct
72 Correct 358 ms 4040 KB Output is correct
73 Correct 347 ms 3468 KB Output is correct
74 Correct 349 ms 3904 KB Output is correct
75 Correct 333 ms 3488 KB Output is correct
76 Correct 16 ms 3480 KB Output is correct
77 Correct 29 ms 3456 KB Output is correct
78 Correct 10 ms 3424 KB Output is correct
79 Correct 72 ms 3504 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 338 ms 3488 KB Output is correct
82 Correct 357 ms 3484 KB Output is correct
83 Correct 334 ms 3468 KB Output is correct
84 Correct 359 ms 3484 KB Output is correct
85 Correct 349 ms 3436 KB Output is correct
86 Correct 359 ms 3552 KB Output is correct
87 Correct 201 ms 3440 KB Output is correct
88 Correct 234 ms 3444 KB Output is correct
89 Correct 203 ms 3428 KB Output is correct
90 Correct 208 ms 3484 KB Output is correct
91 Correct 199 ms 3944 KB Output is correct
92 Correct 220 ms 3476 KB Output is correct
93 Correct 204 ms 3476 KB Output is correct
94 Correct 205 ms 3960 KB Output is correct
95 Correct 209 ms 3440 KB Output is correct
96 Correct 220 ms 3472 KB Output is correct
97 Correct 210 ms 3472 KB Output is correct
98 Correct 210 ms 3584 KB Output is correct
99 Correct 212 ms 3464 KB Output is correct
100 Correct 204 ms 3904 KB Output is correct
101 Correct 334 ms 3472 KB Output is correct
102 Correct 345 ms 3440 KB Output is correct
103 Correct 364 ms 3912 KB Output is correct
104 Correct 338 ms 3484 KB Output is correct
105 Correct 353 ms 3956 KB Output is correct
106 Correct 371 ms 3468 KB Output is correct
107 Correct 342 ms 3464 KB Output is correct
108 Correct 361 ms 4684 KB Output is correct
109 Correct 324 ms 3952 KB Output is correct
110 Correct 360 ms 4676 KB Output is correct
111 Correct 68 ms 3508 KB Output is correct
112 Correct 205 ms 3520 KB Output is correct
113 Correct 218 ms 3476 KB Output is correct
114 Correct 204 ms 3488 KB Output is correct
115 Correct 210 ms 3432 KB Output is correct
116 Correct 205 ms 3960 KB Output is correct
117 Correct 216 ms 3440 KB Output is correct
118 Correct 205 ms 3456 KB Output is correct
119 Correct 207 ms 3960 KB Output is correct
120 Correct 230 ms 3440 KB Output is correct
121 Correct 359 ms 3480 KB Output is correct
122 Correct 367 ms 3476 KB Output is correct
123 Correct 338 ms 3460 KB Output is correct
124 Correct 339 ms 3508 KB Output is correct
125 Correct 338 ms 4024 KB Output is correct
126 Correct 335 ms 3484 KB Output is correct
127 Correct 360 ms 3948 KB Output is correct
128 Correct 336 ms 3432 KB Output is correct
129 Correct 646 ms 3484 KB Output is correct
130 Correct 674 ms 3440 KB Output is correct
131 Correct 662 ms 3948 KB Output is correct
132 Correct 685 ms 3424 KB Output is correct
133 Correct 681 ms 3948 KB Output is correct
134 Correct 702 ms 3672 KB Output is correct
135 Correct 708 ms 4068 KB Output is correct
136 Correct 710 ms 3500 KB Output is correct
137 Correct 17 ms 3532 KB Output is correct
138 Correct 24 ms 3500 KB Output is correct
139 Correct 10 ms 3500 KB Output is correct
140 Correct 68 ms 3504 KB Output is correct
141 Correct 0 ms 212 KB Output is correct
142 Correct 359 ms 3468 KB Output is correct
143 Correct 356 ms 3492 KB Output is correct
144 Correct 366 ms 3444 KB Output is correct
145 Correct 390 ms 3464 KB Output is correct
146 Correct 354 ms 3488 KB Output is correct
147 Correct 325 ms 3512 KB Output is correct
148 Correct 1 ms 212 KB Output is correct
149 Correct 701 ms 3452 KB Output is correct
150 Correct 668 ms 3512 KB Output is correct
151 Correct 725 ms 3668 KB Output is correct
152 Correct 697 ms 3484 KB Output is correct
153 Correct 691 ms 3516 KB Output is correct
154 Correct 646 ms 3452 KB Output is correct
155 Correct 188 ms 3452 KB Output is correct
156 Correct 209 ms 3452 KB Output is correct
157 Correct 201 ms 3484 KB Output is correct
158 Correct 194 ms 3440 KB Output is correct
159 Correct 194 ms 3916 KB Output is correct
160 Correct 189 ms 3460 KB Output is correct
161 Correct 192 ms 3444 KB Output is correct
162 Correct 186 ms 3960 KB Output is correct
163 Correct 196 ms 3488 KB Output is correct
164 Correct 311 ms 3464 KB Output is correct
165 Correct 314 ms 3488 KB Output is correct
166 Correct 323 ms 3904 KB Output is correct
167 Correct 316 ms 3432 KB Output is correct
168 Correct 323 ms 3916 KB Output is correct
169 Correct 329 ms 3460 KB Output is correct
170 Correct 203 ms 3520 KB Output is correct
171 Correct 195 ms 3520 KB Output is correct
172 Correct 192 ms 3492 KB Output is correct
173 Correct 200 ms 3512 KB Output is correct
174 Correct 194 ms 3956 KB Output is correct
175 Correct 324 ms 3472 KB Output is correct
176 Correct 341 ms 4584 KB Output is correct
177 Correct 319 ms 3936 KB Output is correct
178 Correct 320 ms 4640 KB Output is correct
179 Correct 633 ms 4036 KB Output is correct
180 Correct 628 ms 3484 KB Output is correct
181 Correct 661 ms 3920 KB Output is correct
182 Correct 618 ms 3572 KB Output is correct
183 Correct 625 ms 3916 KB Output is correct
184 Correct 670 ms 3448 KB Output is correct
185 Correct 661 ms 3640 KB Output is correct
186 Correct 656 ms 3488 KB Output is correct
187 Correct 665 ms 3500 KB Output is correct
188 Correct 661 ms 3960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 3548 KB Output is correct
2 Correct 210 ms 3492 KB Output is correct
3 Correct 216 ms 3480 KB Output is correct
4 Correct 206 ms 3484 KB Output is correct
5 Correct 226 ms 3516 KB Output is correct
6 Correct 209 ms 3960 KB Output is correct
7 Correct 203 ms 3492 KB Output is correct
8 Correct 228 ms 3512 KB Output is correct
9 Correct 229 ms 3956 KB Output is correct
10 Correct 200 ms 3552 KB Output is correct
11 Correct 70 ms 3464 KB Output is correct
12 Correct 201 ms 3448 KB Output is correct
13 Correct 209 ms 3452 KB Output is correct
14 Correct 204 ms 3436 KB Output is correct
15 Correct 212 ms 3476 KB Output is correct
16 Correct 199 ms 3916 KB Output is correct
17 Correct 197 ms 3440 KB Output is correct
18 Correct 212 ms 3484 KB Output is correct
19 Correct 198 ms 3952 KB Output is correct
20 Correct 214 ms 3444 KB Output is correct
21 Correct 343 ms 3464 KB Output is correct
22 Correct 360 ms 3504 KB Output is correct
23 Correct 355 ms 3452 KB Output is correct
24 Correct 332 ms 3504 KB Output is correct
25 Correct 358 ms 4040 KB Output is correct
26 Correct 347 ms 3468 KB Output is correct
27 Correct 349 ms 3904 KB Output is correct
28 Correct 333 ms 3488 KB Output is correct
29 Correct 68 ms 3508 KB Output is correct
30 Correct 205 ms 3520 KB Output is correct
31 Correct 218 ms 3476 KB Output is correct
32 Correct 204 ms 3488 KB Output is correct
33 Correct 210 ms 3432 KB Output is correct
34 Correct 205 ms 3960 KB Output is correct
35 Correct 216 ms 3440 KB Output is correct
36 Correct 205 ms 3456 KB Output is correct
37 Correct 207 ms 3960 KB Output is correct
38 Correct 230 ms 3440 KB Output is correct
39 Correct 359 ms 3480 KB Output is correct
40 Correct 367 ms 3476 KB Output is correct
41 Correct 338 ms 3460 KB Output is correct
42 Correct 339 ms 3508 KB Output is correct
43 Correct 338 ms 4024 KB Output is correct
44 Correct 335 ms 3484 KB Output is correct
45 Correct 360 ms 3948 KB Output is correct
46 Correct 336 ms 3432 KB Output is correct
47 Correct 646 ms 3484 KB Output is correct
48 Correct 674 ms 3440 KB Output is correct
49 Correct 662 ms 3948 KB Output is correct
50 Correct 685 ms 3424 KB Output is correct
51 Correct 681 ms 3948 KB Output is correct
52 Correct 702 ms 3672 KB Output is correct
53 Correct 708 ms 4068 KB Output is correct
54 Correct 710 ms 3500 KB Output is correct
55 Correct 65 ms 3448 KB Output is correct
56 Correct 231 ms 3436 KB Output is correct
57 Correct 193 ms 3452 KB Output is correct
58 Correct 193 ms 3516 KB Output is correct
59 Correct 191 ms 3536 KB Output is correct
60 Correct 185 ms 3956 KB Output is correct
61 Correct 191 ms 3612 KB Output is correct
62 Correct 191 ms 3440 KB Output is correct
63 Correct 194 ms 4044 KB Output is correct
64 Correct 188 ms 3444 KB Output is correct
65 Correct 322 ms 3684 KB Output is correct
66 Correct 320 ms 3472 KB Output is correct
67 Correct 321 ms 3468 KB Output is correct
68 Correct 322 ms 3464 KB Output is correct
69 Correct 314 ms 3916 KB Output is correct
70 Correct 313 ms 3536 KB Output is correct
71 Correct 310 ms 4048 KB Output is correct
72 Correct 320 ms 3460 KB Output is correct
73 Correct 633 ms 3488 KB Output is correct
74 Correct 651 ms 3476 KB Output is correct
75 Correct 677 ms 4044 KB Output is correct
76 Correct 669 ms 3496 KB Output is correct
77 Correct 696 ms 4044 KB Output is correct
78 Correct 704 ms 3500 KB Output is correct
79 Correct 713 ms 3896 KB Output is correct
80 Correct 700 ms 3520 KB Output is correct
81 Correct 2037 ms 3484 KB Output is correct
82 Correct 2041 ms 3556 KB Output is correct
83 Correct 1988 ms 3496 KB Output is correct
84 Correct 1908 ms 4020 KB Output is correct
85 Correct 1965 ms 3600 KB Output is correct
86 Correct 1864 ms 3632 KB Output is correct
87 Correct 1909 ms 3536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 3532 KB Output is correct
2 Correct 22 ms 3540 KB Output is correct
3 Correct 9 ms 3424 KB Output is correct
4 Correct 71 ms 3448 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 356 ms 3472 KB Output is correct
7 Correct 360 ms 3484 KB Output is correct
8 Correct 339 ms 3444 KB Output is correct
9 Correct 369 ms 3540 KB Output is correct
10 Correct 348 ms 3428 KB Output is correct
11 Correct 353 ms 3588 KB Output is correct
12 Correct 17 ms 3528 KB Output is correct
13 Correct 23 ms 3488 KB Output is correct
14 Correct 9 ms 3424 KB Output is correct
15 Correct 69 ms 3444 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 371 ms 3460 KB Output is correct
18 Correct 342 ms 3432 KB Output is correct
19 Correct 375 ms 3464 KB Output is correct
20 Correct 365 ms 3468 KB Output is correct
21 Correct 329 ms 3444 KB Output is correct
22 Correct 356 ms 3464 KB Output is correct
23 Correct 1 ms 232 KB Output is correct
24 Correct 720 ms 3444 KB Output is correct
25 Correct 695 ms 3488 KB Output is correct
26 Correct 718 ms 3464 KB Output is correct
27 Correct 723 ms 3456 KB Output is correct
28 Correct 675 ms 3484 KB Output is correct
29 Correct 688 ms 3484 KB Output is correct
30 Correct 69 ms 3548 KB Output is correct
31 Correct 210 ms 3492 KB Output is correct
32 Correct 216 ms 3480 KB Output is correct
33 Correct 206 ms 3484 KB Output is correct
34 Correct 226 ms 3516 KB Output is correct
35 Correct 209 ms 3960 KB Output is correct
36 Correct 203 ms 3492 KB Output is correct
37 Correct 228 ms 3512 KB Output is correct
38 Correct 229 ms 3956 KB Output is correct
39 Correct 200 ms 3552 KB Output is correct
40 Correct 16 ms 3532 KB Output is correct
41 Correct 23 ms 3524 KB Output is correct
42 Correct 11 ms 3424 KB Output is correct
43 Correct 79 ms 3452 KB Output is correct
44 Correct 198 ms 3448 KB Output is correct
45 Correct 203 ms 3488 KB Output is correct
46 Correct 217 ms 3436 KB Output is correct
47 Correct 198 ms 3516 KB Output is correct
48 Correct 215 ms 4092 KB Output is correct
49 Correct 213 ms 3460 KB Output is correct
50 Correct 205 ms 3444 KB Output is correct
51 Correct 212 ms 3956 KB Output is correct
52 Correct 213 ms 3576 KB Output is correct
53 Correct 208 ms 3588 KB Output is correct
54 Correct 213 ms 3504 KB Output is correct
55 Correct 202 ms 3484 KB Output is correct
56 Correct 199 ms 3476 KB Output is correct
57 Correct 218 ms 3896 KB Output is correct
58 Correct 70 ms 3464 KB Output is correct
59 Correct 201 ms 3448 KB Output is correct
60 Correct 209 ms 3452 KB Output is correct
61 Correct 204 ms 3436 KB Output is correct
62 Correct 212 ms 3476 KB Output is correct
63 Correct 199 ms 3916 KB Output is correct
64 Correct 197 ms 3440 KB Output is correct
65 Correct 212 ms 3484 KB Output is correct
66 Correct 198 ms 3952 KB Output is correct
67 Correct 214 ms 3444 KB Output is correct
68 Correct 343 ms 3464 KB Output is correct
69 Correct 360 ms 3504 KB Output is correct
70 Correct 355 ms 3452 KB Output is correct
71 Correct 332 ms 3504 KB Output is correct
72 Correct 358 ms 4040 KB Output is correct
73 Correct 347 ms 3468 KB Output is correct
74 Correct 349 ms 3904 KB Output is correct
75 Correct 333 ms 3488 KB Output is correct
76 Correct 16 ms 3480 KB Output is correct
77 Correct 29 ms 3456 KB Output is correct
78 Correct 10 ms 3424 KB Output is correct
79 Correct 72 ms 3504 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 338 ms 3488 KB Output is correct
82 Correct 357 ms 3484 KB Output is correct
83 Correct 334 ms 3468 KB Output is correct
84 Correct 359 ms 3484 KB Output is correct
85 Correct 349 ms 3436 KB Output is correct
86 Correct 359 ms 3552 KB Output is correct
87 Correct 201 ms 3440 KB Output is correct
88 Correct 234 ms 3444 KB Output is correct
89 Correct 203 ms 3428 KB Output is correct
90 Correct 208 ms 3484 KB Output is correct
91 Correct 199 ms 3944 KB Output is correct
92 Correct 220 ms 3476 KB Output is correct
93 Correct 204 ms 3476 KB Output is correct
94 Correct 205 ms 3960 KB Output is correct
95 Correct 209 ms 3440 KB Output is correct
96 Correct 220 ms 3472 KB Output is correct
97 Correct 210 ms 3472 KB Output is correct
98 Correct 210 ms 3584 KB Output is correct
99 Correct 212 ms 3464 KB Output is correct
100 Correct 204 ms 3904 KB Output is correct
101 Correct 334 ms 3472 KB Output is correct
102 Correct 345 ms 3440 KB Output is correct
103 Correct 364 ms 3912 KB Output is correct
104 Correct 338 ms 3484 KB Output is correct
105 Correct 353 ms 3956 KB Output is correct
106 Correct 371 ms 3468 KB Output is correct
107 Correct 342 ms 3464 KB Output is correct
108 Correct 361 ms 4684 KB Output is correct
109 Correct 324 ms 3952 KB Output is correct
110 Correct 360 ms 4676 KB Output is correct
111 Correct 68 ms 3508 KB Output is correct
112 Correct 205 ms 3520 KB Output is correct
113 Correct 218 ms 3476 KB Output is correct
114 Correct 204 ms 3488 KB Output is correct
115 Correct 210 ms 3432 KB Output is correct
116 Correct 205 ms 3960 KB Output is correct
117 Correct 216 ms 3440 KB Output is correct
118 Correct 205 ms 3456 KB Output is correct
119 Correct 207 ms 3960 KB Output is correct
120 Correct 230 ms 3440 KB Output is correct
121 Correct 359 ms 3480 KB Output is correct
122 Correct 367 ms 3476 KB Output is correct
123 Correct 338 ms 3460 KB Output is correct
124 Correct 339 ms 3508 KB Output is correct
125 Correct 338 ms 4024 KB Output is correct
126 Correct 335 ms 3484 KB Output is correct
127 Correct 360 ms 3948 KB Output is correct
128 Correct 336 ms 3432 KB Output is correct
129 Correct 646 ms 3484 KB Output is correct
130 Correct 674 ms 3440 KB Output is correct
131 Correct 662 ms 3948 KB Output is correct
132 Correct 685 ms 3424 KB Output is correct
133 Correct 681 ms 3948 KB Output is correct
134 Correct 702 ms 3672 KB Output is correct
135 Correct 708 ms 4068 KB Output is correct
136 Correct 710 ms 3500 KB Output is correct
137 Correct 17 ms 3532 KB Output is correct
138 Correct 24 ms 3500 KB Output is correct
139 Correct 10 ms 3500 KB Output is correct
140 Correct 68 ms 3504 KB Output is correct
141 Correct 0 ms 212 KB Output is correct
142 Correct 359 ms 3468 KB Output is correct
143 Correct 356 ms 3492 KB Output is correct
144 Correct 366 ms 3444 KB Output is correct
145 Correct 390 ms 3464 KB Output is correct
146 Correct 354 ms 3488 KB Output is correct
147 Correct 325 ms 3512 KB Output is correct
148 Correct 1 ms 212 KB Output is correct
149 Correct 701 ms 3452 KB Output is correct
150 Correct 668 ms 3512 KB Output is correct
151 Correct 725 ms 3668 KB Output is correct
152 Correct 697 ms 3484 KB Output is correct
153 Correct 691 ms 3516 KB Output is correct
154 Correct 646 ms 3452 KB Output is correct
155 Correct 188 ms 3452 KB Output is correct
156 Correct 209 ms 3452 KB Output is correct
157 Correct 201 ms 3484 KB Output is correct
158 Correct 194 ms 3440 KB Output is correct
159 Correct 194 ms 3916 KB Output is correct
160 Correct 189 ms 3460 KB Output is correct
161 Correct 192 ms 3444 KB Output is correct
162 Correct 186 ms 3960 KB Output is correct
163 Correct 196 ms 3488 KB Output is correct
164 Correct 311 ms 3464 KB Output is correct
165 Correct 314 ms 3488 KB Output is correct
166 Correct 323 ms 3904 KB Output is correct
167 Correct 316 ms 3432 KB Output is correct
168 Correct 323 ms 3916 KB Output is correct
169 Correct 329 ms 3460 KB Output is correct
170 Correct 203 ms 3520 KB Output is correct
171 Correct 195 ms 3520 KB Output is correct
172 Correct 192 ms 3492 KB Output is correct
173 Correct 200 ms 3512 KB Output is correct
174 Correct 194 ms 3956 KB Output is correct
175 Correct 324 ms 3472 KB Output is correct
176 Correct 341 ms 4584 KB Output is correct
177 Correct 319 ms 3936 KB Output is correct
178 Correct 320 ms 4640 KB Output is correct
179 Correct 633 ms 4036 KB Output is correct
180 Correct 628 ms 3484 KB Output is correct
181 Correct 661 ms 3920 KB Output is correct
182 Correct 618 ms 3572 KB Output is correct
183 Correct 625 ms 3916 KB Output is correct
184 Correct 670 ms 3448 KB Output is correct
185 Correct 661 ms 3640 KB Output is correct
186 Correct 656 ms 3488 KB Output is correct
187 Correct 665 ms 3500 KB Output is correct
188 Correct 661 ms 3960 KB Output is correct
189 Correct 65 ms 3448 KB Output is correct
190 Correct 231 ms 3436 KB Output is correct
191 Correct 193 ms 3452 KB Output is correct
192 Correct 193 ms 3516 KB Output is correct
193 Correct 191 ms 3536 KB Output is correct
194 Correct 185 ms 3956 KB Output is correct
195 Correct 191 ms 3612 KB Output is correct
196 Correct 191 ms 3440 KB Output is correct
197 Correct 194 ms 4044 KB Output is correct
198 Correct 188 ms 3444 KB Output is correct
199 Correct 322 ms 3684 KB Output is correct
200 Correct 320 ms 3472 KB Output is correct
201 Correct 321 ms 3468 KB Output is correct
202 Correct 322 ms 3464 KB Output is correct
203 Correct 314 ms 3916 KB Output is correct
204 Correct 313 ms 3536 KB Output is correct
205 Correct 310 ms 4048 KB Output is correct
206 Correct 320 ms 3460 KB Output is correct
207 Correct 633 ms 3488 KB Output is correct
208 Correct 651 ms 3476 KB Output is correct
209 Correct 677 ms 4044 KB Output is correct
210 Correct 669 ms 3496 KB Output is correct
211 Correct 696 ms 4044 KB Output is correct
212 Correct 704 ms 3500 KB Output is correct
213 Correct 713 ms 3896 KB Output is correct
214 Correct 700 ms 3520 KB Output is correct
215 Correct 2037 ms 3484 KB Output is correct
216 Correct 2041 ms 3556 KB Output is correct
217 Correct 1988 ms 3496 KB Output is correct
218 Correct 1908 ms 4020 KB Output is correct
219 Correct 1965 ms 3600 KB Output is correct
220 Correct 1864 ms 3632 KB Output is correct
221 Correct 1909 ms 3536 KB Output is correct
222 Correct 75 ms 3540 KB Output is correct
223 Correct 200 ms 3440 KB Output is correct
224 Correct 195 ms 3512 KB Output is correct
225 Correct 203 ms 3448 KB Output is correct
226 Correct 188 ms 3472 KB Output is correct
227 Correct 189 ms 4040 KB Output is correct
228 Correct 185 ms 3488 KB Output is correct
229 Correct 190 ms 3512 KB Output is correct
230 Correct 190 ms 3960 KB Output is correct
231 Correct 193 ms 3588 KB Output is correct
232 Correct 311 ms 3472 KB Output is correct
233 Correct 322 ms 3484 KB Output is correct
234 Correct 335 ms 3468 KB Output is correct
235 Correct 325 ms 3468 KB Output is correct
236 Correct 322 ms 3920 KB Output is correct
237 Correct 320 ms 3504 KB Output is correct
238 Correct 320 ms 3908 KB Output is correct
239 Correct 333 ms 3460 KB Output is correct
240 Correct 625 ms 3488 KB Output is correct
241 Correct 631 ms 3476 KB Output is correct
242 Correct 642 ms 3872 KB Output is correct
243 Correct 638 ms 3488 KB Output is correct
244 Correct 635 ms 3916 KB Output is correct
245 Correct 631 ms 3480 KB Output is correct
246 Correct 651 ms 3956 KB Output is correct
247 Correct 630 ms 3480 KB Output is correct
248 Correct 15 ms 3532 KB Output is correct
249 Correct 22 ms 3524 KB Output is correct
250 Correct 10 ms 3424 KB Output is correct
251 Correct 0 ms 212 KB Output is correct
252 Correct 338 ms 3512 KB Output is correct
253 Correct 327 ms 3472 KB Output is correct
254 Correct 319 ms 3484 KB Output is correct
255 Correct 330 ms 3464 KB Output is correct
256 Correct 0 ms 212 KB Output is correct
257 Correct 670 ms 3540 KB Output is correct
258 Correct 653 ms 3496 KB Output is correct
259 Correct 668 ms 3444 KB Output is correct
260 Correct 698 ms 3504 KB Output is correct
261 Correct 202 ms 3532 KB Output is correct
262 Correct 196 ms 3504 KB Output is correct
263 Correct 197 ms 3484 KB Output is correct
264 Correct 199 ms 3588 KB Output is correct
265 Correct 199 ms 3952 KB Output is correct
266 Correct 323 ms 3468 KB Output is correct
267 Correct 338 ms 4684 KB Output is correct
268 Correct 318 ms 3864 KB Output is correct
269 Correct 331 ms 4696 KB Output is correct
270 Correct 646 ms 3532 KB Output is correct
271 Correct 653 ms 3520 KB Output is correct
272 Correct 663 ms 3588 KB Output is correct
273 Correct 652 ms 3988 KB Output is correct
274 Correct 1893 ms 3684 KB Output is correct
275 Correct 1908 ms 3716 KB Output is correct
276 Correct 1960 ms 3504 KB Output is correct
277 Correct 2041 ms 3916 KB Output is correct
278 Correct 1903 ms 3476 KB Output is correct
279 Correct 1911 ms 3468 KB Output is correct
280 Correct 1909 ms 3500 KB Output is correct
281 Correct 1924 ms 3696 KB Output is correct
282 Correct 1942 ms 4716 KB Output is correct
283 Correct 1998 ms 4628 KB Output is correct