Submission #673211

# Submission time Handle Problem Language Result Execution time Memory
673211 2022-12-19T22:36:42 Z US3RN4M3 Uplifting Excursion (BOI22_vault) C++17
80 / 100
1943 ms 7784 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int mx = 305;
const int mx2 = mx*mx/2;
const ll inf = 1e18;
const ll ninf = -1e18;
ll m, l;
ll cnt_neg[mx];
ll cnt_pos[mx];
ll cnt_zero;
ll dp[mx2*2];
ll cnt_pos_good[mx];
ll cnt_pos_bad[mx];
ll cnt_neg_good[mx];
ll cnt_neg_bad[mx];
void solve(ll target, ll cur_cnt_sum) {
	if(target >= mx2 || target < -mx2) {
		cout << "impossible" << endl;
		return;
	}
	dp[mx2 + target] = cur_cnt_sum;
	for(int i = 1; i <= m; i++) {
		/* positive good */
		if(cnt_pos_good[i]) {
			for(int residue = 0; residue < i; residue++) {
				map<ll, ll> vals;
				vector<ll> history;
				ll t = 0;
				for(int cur_pos = residue; cur_pos < mx2*2; cur_pos += i) {
					ll tmp_val = dp[cur_pos] - t;
					if(vals.size())
						dp[cur_pos] = max(dp[cur_pos], vals.rbegin()->first + t);
					vals[tmp_val]++;
					history.push_back(tmp_val);
					if(t >= cnt_pos_good[i]) {
						ll tmp = history[t - cnt_pos_good[i]];
						vals[tmp]--;
						if(vals[tmp] == 0) vals.erase(tmp);
					}
					t++;
				}
			}
		}
		/* positive bad */
		if(cnt_pos_bad[i]) {
			for(int residue = 0; residue < i; residue++) {
				map<ll, ll> vals;
				vector<ll> history;
				ll t = 0;
				for(int cur_pos = residue; cur_pos < mx2*2; cur_pos += i) {
					ll tmp_val = dp[cur_pos] + t;
					if(vals.size())
						dp[cur_pos] = max(dp[cur_pos], vals.rbegin()->first - t);
					vals[tmp_val]++;
					history.push_back(tmp_val);
					if(t >= cnt_pos_bad[i]) {
						ll tmp = history[t - cnt_pos_bad[i]];
						vals[tmp]--;
						if(vals[tmp] == 0) vals.erase(tmp);
					}
					t++;
				}
			}
		}
		/* negitive good */
		if(cnt_neg_good[i]) {
			for(int residue = 0; residue < i; residue++) {
				map<ll, ll> vals;
				vector<ll> history;
				ll t = 0;
				for(int cur_neg = mx2*2 - 1 - residue; cur_neg >= 0; cur_neg -= i) {
					ll tmp_val = dp[cur_neg] - t;
					if(vals.size())
						dp[cur_neg] = max(dp[cur_neg], vals.rbegin()->first + t);
					vals[tmp_val]++;
					history.push_back(tmp_val);
					if(t >= cnt_neg_good[i]) {
						ll tmp = history[t - cnt_neg_good[i]];
						vals[tmp]--;
						if(vals[tmp] == 0) vals.erase(tmp);
					}
					t++;
				}
			}
		}
		/* negitive bad */
		if(cnt_neg_bad[i]) {
			for(int residue = 0; residue < i; residue++) {
				map<ll, ll> vals;
				vector<ll> history;
				ll t = 0;
				for(int cur_neg = mx2*2 - 1 - residue; cur_neg >= 0; cur_neg -= i) {
					ll tmp_val = dp[cur_neg] + t;
					if(vals.size())
						dp[cur_neg] = max(dp[cur_neg], vals.rbegin()->first - t);
					vals[tmp_val]++;
					history.push_back(tmp_val);
					if(t >= cnt_neg_bad[i]) {
						ll tmp = history[t - cnt_neg_bad[i]];
						vals[tmp]--;
						if(vals[tmp] == 0) vals.erase(tmp);
					}
					t++;
				}
			}
		}
	}
	if(dp[mx2] < 0) cout << "impossible" << endl;
	else cout << dp[mx2] << endl;
}
void eq() {
	ll total_cnt = cnt_zero;
	for(int i = 1; i <= m; i++) {
		total_cnt += cnt_neg[i] + cnt_pos[i];
	}
	cout << total_cnt << endl;
	exit(0);
}
void more_pos() {
	ll sum_neg = l;
	for(int i = 1; i <= m; i++) {
		sum_neg += cnt_neg[i] * i;
	}
	/* binary search: */
	ll cnt_pos_used = 0;
	for(ll delta = (1ll<<60); delta >= 1; delta >>= 1) {
		ll test_value = cnt_pos_used + delta;
		ll cur_sum = 0;
		ll remaining = test_value;
		for(int i = 1; i <= m; i++) {
			if(cnt_pos[i] >= remaining) {
				cur_sum += remaining * i;
				remaining = 0;
				break;
			} else {
				cur_sum += cnt_pos[i] * i;
				remaining -= cnt_pos[i];
			}
		}
		if(remaining > 0) continue;
		if(cur_sum < sum_neg) cnt_pos_used = test_value;
	}
	cnt_pos_used++;
	ll target = -sum_neg;
	ll remaining = cnt_pos_used;
	ll ans = cnt_pos_used + cnt_zero;
	for(int i = 1; i <= m; i++) {
		if(remaining <= cnt_pos[i]) {
			cnt_pos_good[i] = cnt_pos[i] - remaining;
			cnt_neg_bad[i] = remaining;
			target += remaining * i;
			remaining = 0;
		} else {
			cnt_neg_bad[i] = cnt_pos[i];
			target += cnt_pos[i] * i;
			remaining -= cnt_pos[i];
		}
		cnt_pos_bad[i] = cnt_neg[i];
		ans += cnt_neg[i];
	}
	solve(target, ans);
}
void more_neg() {
	for(int i = 1; i <= m; i++) {
		swap(cnt_pos[i], cnt_neg[i]);
	}
	l *= -1;
	more_pos();
}
main() {
	for(int i = 0; i < mx2*2; i++) dp[i] = ninf;
	cin >> m >> l;
	ll sum_pos = 0;
	ll sum_neg = 0;
	for(int i = m; i >= 1; i--) {
		cin >> cnt_neg[i];
		sum_neg += cnt_neg[i] * i;
	}
	cin >> cnt_zero;
	for(int i = 1; i <= m; i++) {
		cin >> cnt_pos[i];
		sum_pos += cnt_pos[i] * i;
	}
	if(sum_pos < l) {
		cout << "impossible" << endl;
		return 0;
	}
	if(sum_pos - sum_neg == l) eq();
	if(sum_pos - sum_neg > l) more_pos();
	if(sum_pos - sum_neg < l) more_neg();
}

Compilation message

vault.cpp:171:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  171 | main() {
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 30 ms 2800 KB Output is correct
2 Correct 23 ms 1884 KB Output is correct
3 Correct 15 ms 2708 KB Output is correct
4 Correct 60 ms 2780 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 922 ms 2792 KB Output is correct
7 Correct 391 ms 1888 KB Output is correct
8 Correct 876 ms 2788 KB Output is correct
9 Correct 938 ms 2692 KB Output is correct
10 Correct 26 ms 1076 KB Output is correct
11 Correct 47 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 2800 KB Output is correct
2 Correct 23 ms 1884 KB Output is correct
3 Correct 15 ms 2708 KB Output is correct
4 Correct 60 ms 2780 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 922 ms 2792 KB Output is correct
7 Correct 391 ms 1888 KB Output is correct
8 Correct 876 ms 2788 KB Output is correct
9 Correct 938 ms 2692 KB Output is correct
10 Correct 26 ms 1076 KB Output is correct
11 Correct 47 ms 980 KB Output is correct
12 Correct 30 ms 2800 KB Output is correct
13 Correct 19 ms 1888 KB Output is correct
14 Correct 20 ms 2720 KB Output is correct
15 Correct 78 ms 2780 KB Output is correct
16 Correct 1 ms 980 KB Output is correct
17 Correct 909 ms 2708 KB Output is correct
18 Correct 381 ms 1888 KB Output is correct
19 Correct 858 ms 2692 KB Output is correct
20 Correct 940 ms 2800 KB Output is correct
21 Correct 29 ms 980 KB Output is correct
22 Correct 47 ms 1068 KB Output is correct
23 Correct 1 ms 980 KB Output is correct
24 Correct 1526 ms 2124 KB Output is correct
25 Correct 701 ms 1236 KB Output is correct
26 Correct 1654 ms 2800 KB Output is correct
27 Correct 1859 ms 2792 KB Output is correct
28 Correct 27 ms 980 KB Output is correct
29 Correct 50 ms 1036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 2732 KB Output is correct
2 Correct 203 ms 3216 KB Output is correct
3 Correct 84 ms 1500 KB Output is correct
4 Correct 255 ms 4236 KB Output is correct
5 Correct 209 ms 2296 KB Output is correct
6 Correct 261 ms 7524 KB Output is correct
7 Correct 15 ms 1236 KB Output is correct
8 Correct 47 ms 1224 KB Output is correct
9 Correct 149 ms 7584 KB Output is correct
10 Correct 179 ms 2124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 2732 KB Output is correct
2 Correct 203 ms 3216 KB Output is correct
3 Correct 84 ms 1500 KB Output is correct
4 Correct 255 ms 4236 KB Output is correct
5 Correct 209 ms 2296 KB Output is correct
6 Correct 261 ms 7524 KB Output is correct
7 Correct 15 ms 1236 KB Output is correct
8 Correct 47 ms 1224 KB Output is correct
9 Correct 149 ms 7584 KB Output is correct
10 Correct 179 ms 2124 KB Output is correct
11 Correct 34 ms 2800 KB Output is correct
12 Correct 20 ms 1888 KB Output is correct
13 Correct 14 ms 2704 KB Output is correct
14 Correct 66 ms 2800 KB Output is correct
15 Correct 198 ms 3216 KB Output is correct
16 Correct 74 ms 1500 KB Output is correct
17 Correct 217 ms 4316 KB Output is correct
18 Correct 208 ms 2340 KB Output is correct
19 Correct 267 ms 7496 KB Output is correct
20 Correct 14 ms 1256 KB Output is correct
21 Correct 38 ms 1224 KB Output is correct
22 Correct 150 ms 7492 KB Output is correct
23 Correct 186 ms 2124 KB Output is correct
24 Correct 385 ms 3196 KB Output is correct
25 Correct 191 ms 1688 KB Output is correct
26 Correct 571 ms 2800 KB Output is correct
27 Correct 420 ms 2796 KB Output is correct
28 Correct 544 ms 7488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 2732 KB Output is correct
2 Correct 203 ms 3216 KB Output is correct
3 Correct 84 ms 1500 KB Output is correct
4 Correct 255 ms 4236 KB Output is correct
5 Correct 209 ms 2296 KB Output is correct
6 Correct 261 ms 7524 KB Output is correct
7 Correct 15 ms 1236 KB Output is correct
8 Correct 47 ms 1224 KB Output is correct
9 Correct 149 ms 7584 KB Output is correct
10 Correct 179 ms 2124 KB Output is correct
11 Correct 64 ms 2672 KB Output is correct
12 Correct 201 ms 3216 KB Output is correct
13 Correct 74 ms 1468 KB Output is correct
14 Correct 248 ms 4248 KB Output is correct
15 Correct 212 ms 2336 KB Output is correct
16 Correct 269 ms 7520 KB Output is correct
17 Correct 13 ms 1260 KB Output is correct
18 Correct 40 ms 1232 KB Output is correct
19 Correct 146 ms 7580 KB Output is correct
20 Correct 197 ms 2124 KB Output is correct
21 Correct 27 ms 980 KB Output is correct
22 Correct 46 ms 980 KB Output is correct
23 Correct 341 ms 2340 KB Output is correct
24 Correct 153 ms 1516 KB Output is correct
25 Correct 322 ms 7508 KB Output is correct
26 Correct 348 ms 4208 KB Output is correct
27 Correct 452 ms 7496 KB Output is correct
28 Correct 260 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 2800 KB Output is correct
2 Correct 23 ms 1884 KB Output is correct
3 Correct 15 ms 2708 KB Output is correct
4 Correct 60 ms 2780 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 922 ms 2792 KB Output is correct
7 Correct 391 ms 1888 KB Output is correct
8 Correct 876 ms 2788 KB Output is correct
9 Correct 938 ms 2692 KB Output is correct
10 Correct 26 ms 1076 KB Output is correct
11 Correct 47 ms 980 KB Output is correct
12 Correct 62 ms 2732 KB Output is correct
13 Correct 203 ms 3216 KB Output is correct
14 Correct 84 ms 1500 KB Output is correct
15 Correct 255 ms 4236 KB Output is correct
16 Correct 209 ms 2296 KB Output is correct
17 Correct 261 ms 7524 KB Output is correct
18 Correct 15 ms 1236 KB Output is correct
19 Correct 47 ms 1224 KB Output is correct
20 Correct 149 ms 7584 KB Output is correct
21 Correct 179 ms 2124 KB Output is correct
22 Correct 34 ms 2800 KB Output is correct
23 Correct 20 ms 1888 KB Output is correct
24 Correct 14 ms 2704 KB Output is correct
25 Correct 66 ms 2800 KB Output is correct
26 Correct 198 ms 3216 KB Output is correct
27 Correct 74 ms 1500 KB Output is correct
28 Correct 217 ms 4316 KB Output is correct
29 Correct 208 ms 2340 KB Output is correct
30 Correct 267 ms 7496 KB Output is correct
31 Correct 14 ms 1256 KB Output is correct
32 Correct 38 ms 1224 KB Output is correct
33 Correct 150 ms 7492 KB Output is correct
34 Correct 186 ms 2124 KB Output is correct
35 Correct 385 ms 3196 KB Output is correct
36 Correct 191 ms 1688 KB Output is correct
37 Correct 571 ms 2800 KB Output is correct
38 Correct 420 ms 2796 KB Output is correct
39 Correct 544 ms 7488 KB Output is correct
40 Correct 64 ms 2672 KB Output is correct
41 Correct 201 ms 3216 KB Output is correct
42 Correct 74 ms 1468 KB Output is correct
43 Correct 248 ms 4248 KB Output is correct
44 Correct 212 ms 2336 KB Output is correct
45 Correct 269 ms 7520 KB Output is correct
46 Correct 13 ms 1260 KB Output is correct
47 Correct 40 ms 1232 KB Output is correct
48 Correct 146 ms 7580 KB Output is correct
49 Correct 197 ms 2124 KB Output is correct
50 Correct 27 ms 980 KB Output is correct
51 Correct 46 ms 980 KB Output is correct
52 Correct 341 ms 2340 KB Output is correct
53 Correct 153 ms 1516 KB Output is correct
54 Correct 322 ms 7508 KB Output is correct
55 Correct 348 ms 4208 KB Output is correct
56 Correct 452 ms 7496 KB Output is correct
57 Correct 260 ms 2644 KB Output is correct
58 Correct 33 ms 2760 KB Output is correct
59 Correct 22 ms 1868 KB Output is correct
60 Correct 16 ms 2800 KB Output is correct
61 Correct 61 ms 2800 KB Output is correct
62 Correct 1 ms 980 KB Output is correct
63 Correct 882 ms 2780 KB Output is correct
64 Correct 392 ms 1888 KB Output is correct
65 Correct 876 ms 2696 KB Output is correct
66 Correct 933 ms 2800 KB Output is correct
67 Correct 25 ms 980 KB Output is correct
68 Correct 56 ms 980 KB Output is correct
69 Correct 227 ms 3212 KB Output is correct
70 Correct 69 ms 1420 KB Output is correct
71 Correct 211 ms 4300 KB Output is correct
72 Correct 207 ms 2340 KB Output is correct
73 Correct 291 ms 7496 KB Output is correct
74 Correct 13 ms 1236 KB Output is correct
75 Correct 37 ms 1236 KB Output is correct
76 Correct 146 ms 7496 KB Output is correct
77 Correct 162 ms 2124 KB Output is correct
78 Correct 387 ms 3200 KB Output is correct
79 Correct 184 ms 1624 KB Output is correct
80 Correct 540 ms 2800 KB Output is correct
81 Correct 398 ms 2800 KB Output is correct
82 Correct 535 ms 7484 KB Output is correct
83 Correct 347 ms 2336 KB Output is correct
84 Correct 147 ms 1528 KB Output is correct
85 Correct 330 ms 7496 KB Output is correct
86 Correct 339 ms 4336 KB Output is correct
87 Correct 451 ms 7496 KB Output is correct
88 Correct 262 ms 2668 KB Output is correct
89 Correct 677 ms 4252 KB Output is correct
90 Correct 734 ms 7488 KB Output is correct
91 Correct 725 ms 7580 KB Output is correct
92 Correct 908 ms 7784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 2732 KB Output is correct
2 Correct 203 ms 3216 KB Output is correct
3 Correct 84 ms 1500 KB Output is correct
4 Correct 255 ms 4236 KB Output is correct
5 Correct 209 ms 2296 KB Output is correct
6 Correct 261 ms 7524 KB Output is correct
7 Correct 15 ms 1236 KB Output is correct
8 Correct 47 ms 1224 KB Output is correct
9 Correct 149 ms 7584 KB Output is correct
10 Correct 179 ms 2124 KB Output is correct
11 Correct 64 ms 2672 KB Output is correct
12 Correct 201 ms 3216 KB Output is correct
13 Correct 74 ms 1468 KB Output is correct
14 Correct 248 ms 4248 KB Output is correct
15 Correct 212 ms 2336 KB Output is correct
16 Correct 269 ms 7520 KB Output is correct
17 Correct 13 ms 1260 KB Output is correct
18 Correct 40 ms 1232 KB Output is correct
19 Correct 146 ms 7580 KB Output is correct
20 Correct 197 ms 2124 KB Output is correct
21 Correct 27 ms 980 KB Output is correct
22 Correct 46 ms 980 KB Output is correct
23 Correct 341 ms 2340 KB Output is correct
24 Correct 153 ms 1516 KB Output is correct
25 Correct 322 ms 7508 KB Output is correct
26 Correct 348 ms 4208 KB Output is correct
27 Correct 452 ms 7496 KB Output is correct
28 Correct 260 ms 2644 KB Output is correct
29 Correct 63 ms 2800 KB Output is correct
30 Correct 227 ms 3208 KB Output is correct
31 Correct 68 ms 1480 KB Output is correct
32 Correct 211 ms 4332 KB Output is correct
33 Correct 220 ms 2432 KB Output is correct
34 Correct 259 ms 7532 KB Output is correct
35 Correct 14 ms 1236 KB Output is correct
36 Correct 37 ms 1208 KB Output is correct
37 Correct 141 ms 7496 KB Output is correct
38 Correct 171 ms 2124 KB Output is correct
39 Correct 27 ms 1076 KB Output is correct
40 Correct 45 ms 980 KB Output is correct
41 Correct 333 ms 2336 KB Output is correct
42 Correct 156 ms 1624 KB Output is correct
43 Correct 325 ms 7496 KB Output is correct
44 Correct 348 ms 4300 KB Output is correct
45 Correct 503 ms 7484 KB Output is correct
46 Correct 263 ms 2672 KB Output is correct
47 Correct 32 ms 980 KB Output is correct
48 Correct 48 ms 1056 KB Output is correct
49 Correct 653 ms 7484 KB Output is correct
50 Correct 266 ms 1240 KB Output is correct
51 Correct 607 ms 7496 KB Output is correct
52 Correct 634 ms 4204 KB Output is correct
53 Correct 930 ms 7488 KB Output is correct
54 Correct 540 ms 4336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 2800 KB Output is correct
2 Correct 23 ms 1884 KB Output is correct
3 Correct 15 ms 2708 KB Output is correct
4 Correct 60 ms 2780 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 922 ms 2792 KB Output is correct
7 Correct 391 ms 1888 KB Output is correct
8 Correct 876 ms 2788 KB Output is correct
9 Correct 938 ms 2692 KB Output is correct
10 Correct 26 ms 1076 KB Output is correct
11 Correct 47 ms 980 KB Output is correct
12 Correct 30 ms 2800 KB Output is correct
13 Correct 19 ms 1888 KB Output is correct
14 Correct 20 ms 2720 KB Output is correct
15 Correct 78 ms 2780 KB Output is correct
16 Correct 1 ms 980 KB Output is correct
17 Correct 909 ms 2708 KB Output is correct
18 Correct 381 ms 1888 KB Output is correct
19 Correct 858 ms 2692 KB Output is correct
20 Correct 940 ms 2800 KB Output is correct
21 Correct 29 ms 980 KB Output is correct
22 Correct 47 ms 1068 KB Output is correct
23 Correct 1 ms 980 KB Output is correct
24 Correct 1526 ms 2124 KB Output is correct
25 Correct 701 ms 1236 KB Output is correct
26 Correct 1654 ms 2800 KB Output is correct
27 Correct 1859 ms 2792 KB Output is correct
28 Correct 27 ms 980 KB Output is correct
29 Correct 50 ms 1036 KB Output is correct
30 Correct 62 ms 2732 KB Output is correct
31 Correct 203 ms 3216 KB Output is correct
32 Correct 84 ms 1500 KB Output is correct
33 Correct 255 ms 4236 KB Output is correct
34 Correct 209 ms 2296 KB Output is correct
35 Correct 261 ms 7524 KB Output is correct
36 Correct 15 ms 1236 KB Output is correct
37 Correct 47 ms 1224 KB Output is correct
38 Correct 149 ms 7584 KB Output is correct
39 Correct 179 ms 2124 KB Output is correct
40 Correct 34 ms 2800 KB Output is correct
41 Correct 20 ms 1888 KB Output is correct
42 Correct 14 ms 2704 KB Output is correct
43 Correct 66 ms 2800 KB Output is correct
44 Correct 198 ms 3216 KB Output is correct
45 Correct 74 ms 1500 KB Output is correct
46 Correct 217 ms 4316 KB Output is correct
47 Correct 208 ms 2340 KB Output is correct
48 Correct 267 ms 7496 KB Output is correct
49 Correct 14 ms 1256 KB Output is correct
50 Correct 38 ms 1224 KB Output is correct
51 Correct 150 ms 7492 KB Output is correct
52 Correct 186 ms 2124 KB Output is correct
53 Correct 385 ms 3196 KB Output is correct
54 Correct 191 ms 1688 KB Output is correct
55 Correct 571 ms 2800 KB Output is correct
56 Correct 420 ms 2796 KB Output is correct
57 Correct 544 ms 7488 KB Output is correct
58 Correct 64 ms 2672 KB Output is correct
59 Correct 201 ms 3216 KB Output is correct
60 Correct 74 ms 1468 KB Output is correct
61 Correct 248 ms 4248 KB Output is correct
62 Correct 212 ms 2336 KB Output is correct
63 Correct 269 ms 7520 KB Output is correct
64 Correct 13 ms 1260 KB Output is correct
65 Correct 40 ms 1232 KB Output is correct
66 Correct 146 ms 7580 KB Output is correct
67 Correct 197 ms 2124 KB Output is correct
68 Correct 27 ms 980 KB Output is correct
69 Correct 46 ms 980 KB Output is correct
70 Correct 341 ms 2340 KB Output is correct
71 Correct 153 ms 1516 KB Output is correct
72 Correct 322 ms 7508 KB Output is correct
73 Correct 348 ms 4208 KB Output is correct
74 Correct 452 ms 7496 KB Output is correct
75 Correct 260 ms 2644 KB Output is correct
76 Correct 33 ms 2760 KB Output is correct
77 Correct 22 ms 1868 KB Output is correct
78 Correct 16 ms 2800 KB Output is correct
79 Correct 61 ms 2800 KB Output is correct
80 Correct 1 ms 980 KB Output is correct
81 Correct 882 ms 2780 KB Output is correct
82 Correct 392 ms 1888 KB Output is correct
83 Correct 876 ms 2696 KB Output is correct
84 Correct 933 ms 2800 KB Output is correct
85 Correct 25 ms 980 KB Output is correct
86 Correct 56 ms 980 KB Output is correct
87 Correct 227 ms 3212 KB Output is correct
88 Correct 69 ms 1420 KB Output is correct
89 Correct 211 ms 4300 KB Output is correct
90 Correct 207 ms 2340 KB Output is correct
91 Correct 291 ms 7496 KB Output is correct
92 Correct 13 ms 1236 KB Output is correct
93 Correct 37 ms 1236 KB Output is correct
94 Correct 146 ms 7496 KB Output is correct
95 Correct 162 ms 2124 KB Output is correct
96 Correct 387 ms 3200 KB Output is correct
97 Correct 184 ms 1624 KB Output is correct
98 Correct 540 ms 2800 KB Output is correct
99 Correct 398 ms 2800 KB Output is correct
100 Correct 535 ms 7484 KB Output is correct
101 Correct 347 ms 2336 KB Output is correct
102 Correct 147 ms 1528 KB Output is correct
103 Correct 330 ms 7496 KB Output is correct
104 Correct 339 ms 4336 KB Output is correct
105 Correct 451 ms 7496 KB Output is correct
106 Correct 262 ms 2668 KB Output is correct
107 Correct 677 ms 4252 KB Output is correct
108 Correct 734 ms 7488 KB Output is correct
109 Correct 725 ms 7580 KB Output is correct
110 Correct 908 ms 7784 KB Output is correct
111 Correct 63 ms 2800 KB Output is correct
112 Correct 227 ms 3208 KB Output is correct
113 Correct 68 ms 1480 KB Output is correct
114 Correct 211 ms 4332 KB Output is correct
115 Correct 220 ms 2432 KB Output is correct
116 Correct 259 ms 7532 KB Output is correct
117 Correct 14 ms 1236 KB Output is correct
118 Correct 37 ms 1208 KB Output is correct
119 Correct 141 ms 7496 KB Output is correct
120 Correct 171 ms 2124 KB Output is correct
121 Correct 27 ms 1076 KB Output is correct
122 Correct 45 ms 980 KB Output is correct
123 Correct 333 ms 2336 KB Output is correct
124 Correct 156 ms 1624 KB Output is correct
125 Correct 325 ms 7496 KB Output is correct
126 Correct 348 ms 4300 KB Output is correct
127 Correct 503 ms 7484 KB Output is correct
128 Correct 263 ms 2672 KB Output is correct
129 Correct 32 ms 980 KB Output is correct
130 Correct 48 ms 1056 KB Output is correct
131 Correct 653 ms 7484 KB Output is correct
132 Correct 266 ms 1240 KB Output is correct
133 Correct 607 ms 7496 KB Output is correct
134 Correct 634 ms 4204 KB Output is correct
135 Correct 930 ms 7488 KB Output is correct
136 Correct 540 ms 4336 KB Output is correct
137 Correct 30 ms 2800 KB Output is correct
138 Correct 19 ms 1908 KB Output is correct
139 Correct 18 ms 2796 KB Output is correct
140 Correct 80 ms 2688 KB Output is correct
141 Correct 1 ms 980 KB Output is correct
142 Correct 886 ms 2704 KB Output is correct
143 Correct 391 ms 1888 KB Output is correct
144 Correct 878 ms 2800 KB Output is correct
145 Correct 955 ms 2792 KB Output is correct
146 Correct 25 ms 1052 KB Output is correct
147 Correct 56 ms 1072 KB Output is correct
148 Correct 1 ms 980 KB Output is correct
149 Correct 1551 ms 2184 KB Output is correct
150 Correct 666 ms 1236 KB Output is correct
151 Correct 1661 ms 2800 KB Output is correct
152 Correct 1943 ms 2712 KB Output is correct
153 Correct 26 ms 980 KB Output is correct
154 Correct 55 ms 1056 KB Output is correct
155 Correct 202 ms 3208 KB Output is correct
156 Correct 71 ms 1420 KB Output is correct
157 Correct 217 ms 4304 KB Output is correct
158 Correct 215 ms 2280 KB Output is correct
159 Correct 266 ms 7496 KB Output is correct
160 Correct 13 ms 1236 KB Output is correct
161 Correct 40 ms 1224 KB Output is correct
162 Correct 148 ms 7532 KB Output is correct
163 Correct 191 ms 2124 KB Output is correct
164 Correct 331 ms 2284 KB Output is correct
165 Correct 148 ms 1528 KB Output is correct
166 Correct 327 ms 7548 KB Output is correct
167 Correct 332 ms 4300 KB Output is correct
168 Correct 478 ms 7496 KB Output is correct
169 Correct 264 ms 2572 KB Output is correct
170 Correct 406 ms 3212 KB Output is correct
171 Correct 188 ms 1680 KB Output is correct
172 Correct 546 ms 2800 KB Output is correct
173 Correct 399 ms 2676 KB Output is correct
174 Correct 538 ms 7528 KB Output is correct
175 Correct 656 ms 4248 KB Output is correct
176 Correct 720 ms 7556 KB Output is correct
177 Correct 682 ms 7528 KB Output is correct
178 Correct 877 ms 7776 KB Output is correct
179 Correct 643 ms 7496 KB Output is correct
180 Correct 265 ms 1164 KB Output is correct
181 Correct 607 ms 7524 KB Output is correct
182 Correct 637 ms 4208 KB Output is correct
183 Correct 903 ms 7496 KB Output is correct
184 Correct 541 ms 4208 KB Output is correct
185 Correct 1249 ms 4348 KB Output is correct
186 Correct 1358 ms 4296 KB Output is correct
187 Correct 1688 ms 4240 KB Output is correct
188 Correct 1743 ms 7532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 2732 KB Output is correct
2 Correct 203 ms 3216 KB Output is correct
3 Correct 84 ms 1500 KB Output is correct
4 Correct 255 ms 4236 KB Output is correct
5 Correct 209 ms 2296 KB Output is correct
6 Correct 261 ms 7524 KB Output is correct
7 Correct 15 ms 1236 KB Output is correct
8 Correct 47 ms 1224 KB Output is correct
9 Correct 149 ms 7584 KB Output is correct
10 Correct 179 ms 2124 KB Output is correct
11 Correct 64 ms 2672 KB Output is correct
12 Correct 201 ms 3216 KB Output is correct
13 Correct 74 ms 1468 KB Output is correct
14 Correct 248 ms 4248 KB Output is correct
15 Correct 212 ms 2336 KB Output is correct
16 Correct 269 ms 7520 KB Output is correct
17 Correct 13 ms 1260 KB Output is correct
18 Correct 40 ms 1232 KB Output is correct
19 Correct 146 ms 7580 KB Output is correct
20 Correct 197 ms 2124 KB Output is correct
21 Correct 27 ms 980 KB Output is correct
22 Correct 46 ms 980 KB Output is correct
23 Correct 341 ms 2340 KB Output is correct
24 Correct 153 ms 1516 KB Output is correct
25 Correct 322 ms 7508 KB Output is correct
26 Correct 348 ms 4208 KB Output is correct
27 Correct 452 ms 7496 KB Output is correct
28 Correct 260 ms 2644 KB Output is correct
29 Correct 63 ms 2800 KB Output is correct
30 Correct 227 ms 3208 KB Output is correct
31 Correct 68 ms 1480 KB Output is correct
32 Correct 211 ms 4332 KB Output is correct
33 Correct 220 ms 2432 KB Output is correct
34 Correct 259 ms 7532 KB Output is correct
35 Correct 14 ms 1236 KB Output is correct
36 Correct 37 ms 1208 KB Output is correct
37 Correct 141 ms 7496 KB Output is correct
38 Correct 171 ms 2124 KB Output is correct
39 Correct 27 ms 1076 KB Output is correct
40 Correct 45 ms 980 KB Output is correct
41 Correct 333 ms 2336 KB Output is correct
42 Correct 156 ms 1624 KB Output is correct
43 Correct 325 ms 7496 KB Output is correct
44 Correct 348 ms 4300 KB Output is correct
45 Correct 503 ms 7484 KB Output is correct
46 Correct 263 ms 2672 KB Output is correct
47 Correct 32 ms 980 KB Output is correct
48 Correct 48 ms 1056 KB Output is correct
49 Correct 653 ms 7484 KB Output is correct
50 Correct 266 ms 1240 KB Output is correct
51 Correct 607 ms 7496 KB Output is correct
52 Correct 634 ms 4204 KB Output is correct
53 Correct 930 ms 7488 KB Output is correct
54 Correct 540 ms 4336 KB Output is correct
55 Correct 63 ms 2740 KB Output is correct
56 Correct 208 ms 3212 KB Output is correct
57 Correct 69 ms 1436 KB Output is correct
58 Correct 223 ms 4420 KB Output is correct
59 Correct 208 ms 2344 KB Output is correct
60 Correct 258 ms 7496 KB Output is correct
61 Correct 13 ms 1232 KB Output is correct
62 Correct 37 ms 1228 KB Output is correct
63 Correct 140 ms 7496 KB Output is correct
64 Correct 161 ms 2124 KB Output is correct
65 Correct 25 ms 980 KB Output is correct
66 Correct 48 ms 980 KB Output is correct
67 Correct 326 ms 2408 KB Output is correct
68 Correct 146 ms 1524 KB Output is correct
69 Correct 324 ms 7524 KB Output is correct
70 Correct 336 ms 4208 KB Output is correct
71 Correct 444 ms 7496 KB Output is correct
72 Correct 254 ms 2664 KB Output is correct
73 Correct 26 ms 980 KB Output is correct
74 Correct 45 ms 1060 KB Output is correct
75 Correct 626 ms 7496 KB Output is correct
76 Correct 268 ms 1288 KB Output is correct
77 Correct 569 ms 7492 KB Output is correct
78 Correct 624 ms 4200 KB Output is correct
79 Correct 881 ms 7604 KB Output is correct
80 Correct 541 ms 4336 KB Output is correct
81 Correct 1844 ms 3212 KB Output is correct
82 Correct 844 ms 1536 KB Output is correct
83 Correct 1815 ms 4336 KB Output is correct
84 Correct 1790 ms 7496 KB Output is correct
85 Incorrect 10 ms 980 KB Output isn't correct
86 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 2800 KB Output is correct
2 Correct 23 ms 1884 KB Output is correct
3 Correct 15 ms 2708 KB Output is correct
4 Correct 60 ms 2780 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 922 ms 2792 KB Output is correct
7 Correct 391 ms 1888 KB Output is correct
8 Correct 876 ms 2788 KB Output is correct
9 Correct 938 ms 2692 KB Output is correct
10 Correct 26 ms 1076 KB Output is correct
11 Correct 47 ms 980 KB Output is correct
12 Correct 30 ms 2800 KB Output is correct
13 Correct 19 ms 1888 KB Output is correct
14 Correct 20 ms 2720 KB Output is correct
15 Correct 78 ms 2780 KB Output is correct
16 Correct 1 ms 980 KB Output is correct
17 Correct 909 ms 2708 KB Output is correct
18 Correct 381 ms 1888 KB Output is correct
19 Correct 858 ms 2692 KB Output is correct
20 Correct 940 ms 2800 KB Output is correct
21 Correct 29 ms 980 KB Output is correct
22 Correct 47 ms 1068 KB Output is correct
23 Correct 1 ms 980 KB Output is correct
24 Correct 1526 ms 2124 KB Output is correct
25 Correct 701 ms 1236 KB Output is correct
26 Correct 1654 ms 2800 KB Output is correct
27 Correct 1859 ms 2792 KB Output is correct
28 Correct 27 ms 980 KB Output is correct
29 Correct 50 ms 1036 KB Output is correct
30 Correct 62 ms 2732 KB Output is correct
31 Correct 203 ms 3216 KB Output is correct
32 Correct 84 ms 1500 KB Output is correct
33 Correct 255 ms 4236 KB Output is correct
34 Correct 209 ms 2296 KB Output is correct
35 Correct 261 ms 7524 KB Output is correct
36 Correct 15 ms 1236 KB Output is correct
37 Correct 47 ms 1224 KB Output is correct
38 Correct 149 ms 7584 KB Output is correct
39 Correct 179 ms 2124 KB Output is correct
40 Correct 34 ms 2800 KB Output is correct
41 Correct 20 ms 1888 KB Output is correct
42 Correct 14 ms 2704 KB Output is correct
43 Correct 66 ms 2800 KB Output is correct
44 Correct 198 ms 3216 KB Output is correct
45 Correct 74 ms 1500 KB Output is correct
46 Correct 217 ms 4316 KB Output is correct
47 Correct 208 ms 2340 KB Output is correct
48 Correct 267 ms 7496 KB Output is correct
49 Correct 14 ms 1256 KB Output is correct
50 Correct 38 ms 1224 KB Output is correct
51 Correct 150 ms 7492 KB Output is correct
52 Correct 186 ms 2124 KB Output is correct
53 Correct 385 ms 3196 KB Output is correct
54 Correct 191 ms 1688 KB Output is correct
55 Correct 571 ms 2800 KB Output is correct
56 Correct 420 ms 2796 KB Output is correct
57 Correct 544 ms 7488 KB Output is correct
58 Correct 64 ms 2672 KB Output is correct
59 Correct 201 ms 3216 KB Output is correct
60 Correct 74 ms 1468 KB Output is correct
61 Correct 248 ms 4248 KB Output is correct
62 Correct 212 ms 2336 KB Output is correct
63 Correct 269 ms 7520 KB Output is correct
64 Correct 13 ms 1260 KB Output is correct
65 Correct 40 ms 1232 KB Output is correct
66 Correct 146 ms 7580 KB Output is correct
67 Correct 197 ms 2124 KB Output is correct
68 Correct 27 ms 980 KB Output is correct
69 Correct 46 ms 980 KB Output is correct
70 Correct 341 ms 2340 KB Output is correct
71 Correct 153 ms 1516 KB Output is correct
72 Correct 322 ms 7508 KB Output is correct
73 Correct 348 ms 4208 KB Output is correct
74 Correct 452 ms 7496 KB Output is correct
75 Correct 260 ms 2644 KB Output is correct
76 Correct 33 ms 2760 KB Output is correct
77 Correct 22 ms 1868 KB Output is correct
78 Correct 16 ms 2800 KB Output is correct
79 Correct 61 ms 2800 KB Output is correct
80 Correct 1 ms 980 KB Output is correct
81 Correct 882 ms 2780 KB Output is correct
82 Correct 392 ms 1888 KB Output is correct
83 Correct 876 ms 2696 KB Output is correct
84 Correct 933 ms 2800 KB Output is correct
85 Correct 25 ms 980 KB Output is correct
86 Correct 56 ms 980 KB Output is correct
87 Correct 227 ms 3212 KB Output is correct
88 Correct 69 ms 1420 KB Output is correct
89 Correct 211 ms 4300 KB Output is correct
90 Correct 207 ms 2340 KB Output is correct
91 Correct 291 ms 7496 KB Output is correct
92 Correct 13 ms 1236 KB Output is correct
93 Correct 37 ms 1236 KB Output is correct
94 Correct 146 ms 7496 KB Output is correct
95 Correct 162 ms 2124 KB Output is correct
96 Correct 387 ms 3200 KB Output is correct
97 Correct 184 ms 1624 KB Output is correct
98 Correct 540 ms 2800 KB Output is correct
99 Correct 398 ms 2800 KB Output is correct
100 Correct 535 ms 7484 KB Output is correct
101 Correct 347 ms 2336 KB Output is correct
102 Correct 147 ms 1528 KB Output is correct
103 Correct 330 ms 7496 KB Output is correct
104 Correct 339 ms 4336 KB Output is correct
105 Correct 451 ms 7496 KB Output is correct
106 Correct 262 ms 2668 KB Output is correct
107 Correct 677 ms 4252 KB Output is correct
108 Correct 734 ms 7488 KB Output is correct
109 Correct 725 ms 7580 KB Output is correct
110 Correct 908 ms 7784 KB Output is correct
111 Correct 63 ms 2800 KB Output is correct
112 Correct 227 ms 3208 KB Output is correct
113 Correct 68 ms 1480 KB Output is correct
114 Correct 211 ms 4332 KB Output is correct
115 Correct 220 ms 2432 KB Output is correct
116 Correct 259 ms 7532 KB Output is correct
117 Correct 14 ms 1236 KB Output is correct
118 Correct 37 ms 1208 KB Output is correct
119 Correct 141 ms 7496 KB Output is correct
120 Correct 171 ms 2124 KB Output is correct
121 Correct 27 ms 1076 KB Output is correct
122 Correct 45 ms 980 KB Output is correct
123 Correct 333 ms 2336 KB Output is correct
124 Correct 156 ms 1624 KB Output is correct
125 Correct 325 ms 7496 KB Output is correct
126 Correct 348 ms 4300 KB Output is correct
127 Correct 503 ms 7484 KB Output is correct
128 Correct 263 ms 2672 KB Output is correct
129 Correct 32 ms 980 KB Output is correct
130 Correct 48 ms 1056 KB Output is correct
131 Correct 653 ms 7484 KB Output is correct
132 Correct 266 ms 1240 KB Output is correct
133 Correct 607 ms 7496 KB Output is correct
134 Correct 634 ms 4204 KB Output is correct
135 Correct 930 ms 7488 KB Output is correct
136 Correct 540 ms 4336 KB Output is correct
137 Correct 30 ms 2800 KB Output is correct
138 Correct 19 ms 1908 KB Output is correct
139 Correct 18 ms 2796 KB Output is correct
140 Correct 80 ms 2688 KB Output is correct
141 Correct 1 ms 980 KB Output is correct
142 Correct 886 ms 2704 KB Output is correct
143 Correct 391 ms 1888 KB Output is correct
144 Correct 878 ms 2800 KB Output is correct
145 Correct 955 ms 2792 KB Output is correct
146 Correct 25 ms 1052 KB Output is correct
147 Correct 56 ms 1072 KB Output is correct
148 Correct 1 ms 980 KB Output is correct
149 Correct 1551 ms 2184 KB Output is correct
150 Correct 666 ms 1236 KB Output is correct
151 Correct 1661 ms 2800 KB Output is correct
152 Correct 1943 ms 2712 KB Output is correct
153 Correct 26 ms 980 KB Output is correct
154 Correct 55 ms 1056 KB Output is correct
155 Correct 202 ms 3208 KB Output is correct
156 Correct 71 ms 1420 KB Output is correct
157 Correct 217 ms 4304 KB Output is correct
158 Correct 215 ms 2280 KB Output is correct
159 Correct 266 ms 7496 KB Output is correct
160 Correct 13 ms 1236 KB Output is correct
161 Correct 40 ms 1224 KB Output is correct
162 Correct 148 ms 7532 KB Output is correct
163 Correct 191 ms 2124 KB Output is correct
164 Correct 331 ms 2284 KB Output is correct
165 Correct 148 ms 1528 KB Output is correct
166 Correct 327 ms 7548 KB Output is correct
167 Correct 332 ms 4300 KB Output is correct
168 Correct 478 ms 7496 KB Output is correct
169 Correct 264 ms 2572 KB Output is correct
170 Correct 406 ms 3212 KB Output is correct
171 Correct 188 ms 1680 KB Output is correct
172 Correct 546 ms 2800 KB Output is correct
173 Correct 399 ms 2676 KB Output is correct
174 Correct 538 ms 7528 KB Output is correct
175 Correct 656 ms 4248 KB Output is correct
176 Correct 720 ms 7556 KB Output is correct
177 Correct 682 ms 7528 KB Output is correct
178 Correct 877 ms 7776 KB Output is correct
179 Correct 643 ms 7496 KB Output is correct
180 Correct 265 ms 1164 KB Output is correct
181 Correct 607 ms 7524 KB Output is correct
182 Correct 637 ms 4208 KB Output is correct
183 Correct 903 ms 7496 KB Output is correct
184 Correct 541 ms 4208 KB Output is correct
185 Correct 1249 ms 4348 KB Output is correct
186 Correct 1358 ms 4296 KB Output is correct
187 Correct 1688 ms 4240 KB Output is correct
188 Correct 1743 ms 7532 KB Output is correct
189 Correct 63 ms 2740 KB Output is correct
190 Correct 208 ms 3212 KB Output is correct
191 Correct 69 ms 1436 KB Output is correct
192 Correct 223 ms 4420 KB Output is correct
193 Correct 208 ms 2344 KB Output is correct
194 Correct 258 ms 7496 KB Output is correct
195 Correct 13 ms 1232 KB Output is correct
196 Correct 37 ms 1228 KB Output is correct
197 Correct 140 ms 7496 KB Output is correct
198 Correct 161 ms 2124 KB Output is correct
199 Correct 25 ms 980 KB Output is correct
200 Correct 48 ms 980 KB Output is correct
201 Correct 326 ms 2408 KB Output is correct
202 Correct 146 ms 1524 KB Output is correct
203 Correct 324 ms 7524 KB Output is correct
204 Correct 336 ms 4208 KB Output is correct
205 Correct 444 ms 7496 KB Output is correct
206 Correct 254 ms 2664 KB Output is correct
207 Correct 26 ms 980 KB Output is correct
208 Correct 45 ms 1060 KB Output is correct
209 Correct 626 ms 7496 KB Output is correct
210 Correct 268 ms 1288 KB Output is correct
211 Correct 569 ms 7492 KB Output is correct
212 Correct 624 ms 4200 KB Output is correct
213 Correct 881 ms 7604 KB Output is correct
214 Correct 541 ms 4336 KB Output is correct
215 Correct 1844 ms 3212 KB Output is correct
216 Correct 844 ms 1536 KB Output is correct
217 Correct 1815 ms 4336 KB Output is correct
218 Correct 1790 ms 7496 KB Output is correct
219 Incorrect 10 ms 980 KB Output isn't correct
220 Halted 0 ms 0 KB -