Submission #745194

# Submission time Handle Problem Language Result Execution time Memory
745194 2023-05-19T14:31:07 Z 박상훈(#9964) Uplifting Excursion (BOI22_vault) C++17
80 / 100
5000 ms 3156 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
constexpr int SFT = 10010;
int n;
ll L, a[1010], b[1010];
bitset<20020> dp[2][606];

// struct BITSET{
// 	unsigned long long bt[MX+1]; //bt[sz] should be 0
// 	int sz; //size < MX
// }dp[2][606];

// void _bit_on(BITSET &B, int pos){
// 	if ((pos>>6) >= sz){
// 		for (int i=sz+1;i<=(pos>>6)+1;i++) bt[i] = 0;
// 		sz = (pos>>6)+1;
// 	}
// 	B.bt[pos>>6] |= 1LL<<(pos&63);
// }

// bool _chk_on(BITSET &B, int pos){
// 	return ((pos>>6) < sz) && (B.bt[pos>>6] & (1LL<<(pos&63)));
// }

// void _shift_or(BITSET &prv, BITSET &now, int sft){
// 	now.sz = prv.sz;
// 	for (int i=0;i<=sz;i++) now.bt[i] = prv.bt[i];


// }

ll getmin(ll v, bool flag = 0){
	ll ret = 0;
	for (int i=-n;i<=n;i++){
		ret += (ll)i * min(v, a[i+n]);
		if (flag) b[i+n] = min(v, a[i+n]);
		v -= min(v, a[i+n]);
	}
	return ret;
}

ll getmax(ll v, bool flag = 0){
	ll ret = 0;
	for (int i=n;i>=-n;i--){
		ret += (ll)i * min(v, a[i+n]);
		if (flag) b[i+n] = min(v, a[i+n]);
		v -= min(v, a[i+n]);
	}
	return ret;
}

void NO(){
	printf("impossible\n");
	exit(0);
}

void solve(ll v){
	ll mn = getmin(v), mx = getmax(v);
	if (abs(mn-L) > n && abs(mx-L) > n) assert(0);
	if (abs(mn-L) <= n){
		reverse(a, a+n*2+1);
		L = -L;
		mn = getmin(v), mx = getmax(v);
		if (abs(mn-L) > n && abs(mx-L) > n) assert(0);
	}
	getmax(v, 1);

	int z = 0;
	ll r = n*2+2;
	
	//init
	// _bit_on(dp[0][0], 0);
	dp[0][0][0+SFT] = 1;

	for (int i=n;i>=-n;i--){
		if (b[i+n] > 0){
			for (int j=1;j<=min(b[i+n], r);j++){
				z ^= 1;
				for (int p=-1;p<r;p++){
					// _shift_or(dp[z^1][p], dp[z][p+1], i);
					
					if (p+1 < j) dp[z][p+1] = dp[z^1][p+1];
					else if (i>=0) dp[z][p+1] = dp[z^1][p+1] | (dp[z^1][p] << i);
					else dp[z][p+1] = dp[z^1][p+1] | (dp[z^1][p] >> (-i));
					
					// printf("i = %d, j = %d, p+1 = %d -> ", i, j, p+1);
					// for (int x=-20;x<20;x++){
					// 	if (x==0) printf(" ");
					// 	printf("%d", (int)dp[z][p+1][x+SFT]);
					// } 
					// printf("\n");
				}
			}
		}

		if (b[i+n] < a[i+n]){
			for (int j=1;j<=min(a[i+n]-b[i+n], r);j++){
				z ^= 1;
				for (int p=1;p<=r+1;p++){
					// _shift_or(dp[z^1][p], dp[z][p-1], -i);
					
					if (r-p+1 < j) dp[z][p-1] = dp[z^1][p-1];
					else if (i>=0) dp[z][p-1] = dp[z^1][p-1] | (dp[z^1][p] >> i);
					else dp[z][p-1] = dp[z^1][p-1] | (dp[z^1][p] << (-i));
					
					// printf("i = %d, j = %d, p-1 = %d -> ", i, j, p-1);
					// for (int x=-20;x<20;x++){
					// 	if (x==0) printf(" ");
					// 	printf("%d", (int)dp[z][p-1][x+SFT]);
					// } 
					// printf("\n");
				}
			}
		}
	}

	ll need = mx - L;
	for (int i=0;i<=r;i++) if (dp[z][i][need+SFT]){
		printf("%lld\n", v-i);
		return;
	}
	NO();
}

int main(){
	scanf("%d %lld", &n, &L);

	ll mS = 0, pS = 0, S = 0;
	for (int i=0;i<=n*2;i++){
		scanf("%lld", a+i);
		S += a[i];
		if (i-n < 0) mS += a[i];
		else if (i-n > 0) pS += a[i];
	} 

	// printf("%lld %lld %lld %lld\n", mS, pS, getmin(mS), getmax(pS));
	if (L < getmin(mS)) NO();
	if (L > getmax(pS)) NO();

	ll l = mS, r = S, vmn = mS;
	while(l<=r){
		ll mid = (l+r)/2;
		if (getmin(mid) <= L) vmn = mid, l = mid+1;
		else r = mid-1;
	}

	l = pS, r = S;
	ll vmx = pS;
	while(l<=r){
		ll mid = (l+r)/2;
		if (getmax(mid) >= L) vmx = mid, l = mid+1;
		else r = mid-1;
	}

	ll v = min(vmn, vmx); // [v+1, S]는 불가능
	// printf("%lld(%lld, %lld) -> %lld %lld\n", v, vmn, vmx, getmin(v), getmax(v));
	if (!(getmin(v) <= L) || !(getmax(v) >= L)) NO();
	solve(v);
}

Compilation message

vault.cpp: In function 'int main()':
vault.cpp:128:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  128 |  scanf("%d %lld", &n, &L);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
vault.cpp:132:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  132 |   scanf("%lld", a+i);
      |   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 227 ms 812 KB Output is correct
7 Correct 86 ms 808 KB Output is correct
8 Correct 205 ms 816 KB Output is correct
9 Correct 351 ms 812 KB Output is correct
10 Correct 9 ms 724 KB Output is correct
11 Correct 8 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 227 ms 812 KB Output is correct
7 Correct 86 ms 808 KB Output is correct
8 Correct 205 ms 816 KB Output is correct
9 Correct 351 ms 812 KB Output is correct
10 Correct 9 ms 724 KB Output is correct
11 Correct 8 ms 724 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 312 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 218 ms 812 KB Output is correct
18 Correct 89 ms 816 KB Output is correct
19 Correct 220 ms 820 KB Output is correct
20 Correct 351 ms 816 KB Output is correct
21 Correct 9 ms 724 KB Output is correct
22 Correct 8 ms 724 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1726 ms 1256 KB Output is correct
25 Correct 563 ms 1304 KB Output is correct
26 Correct 2957 ms 1356 KB Output is correct
27 Correct 2907 ms 1356 KB Output is correct
28 Correct 39 ms 1236 KB Output is correct
29 Correct 34 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 39 ms 596 KB Output is correct
3 Correct 11 ms 636 KB Output is correct
4 Correct 40 ms 596 KB Output is correct
5 Correct 46 ms 596 KB Output is correct
6 Correct 27 ms 596 KB Output is correct
7 Correct 7 ms 636 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 15 ms 596 KB Output is correct
10 Correct 28 ms 628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 39 ms 596 KB Output is correct
3 Correct 11 ms 636 KB Output is correct
4 Correct 40 ms 596 KB Output is correct
5 Correct 46 ms 596 KB Output is correct
6 Correct 27 ms 596 KB Output is correct
7 Correct 7 ms 636 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 15 ms 596 KB Output is correct
10 Correct 28 ms 628 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 42 ms 596 KB Output is correct
16 Correct 12 ms 596 KB Output is correct
17 Correct 43 ms 596 KB Output is correct
18 Correct 54 ms 596 KB Output is correct
19 Correct 27 ms 596 KB Output is correct
20 Correct 6 ms 596 KB Output is correct
21 Correct 6 ms 596 KB Output is correct
22 Correct 16 ms 636 KB Output is correct
23 Correct 27 ms 596 KB Output is correct
24 Correct 74 ms 624 KB Output is correct
25 Correct 29 ms 716 KB Output is correct
26 Correct 92 ms 612 KB Output is correct
27 Correct 63 ms 596 KB Output is correct
28 Correct 71 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 39 ms 596 KB Output is correct
3 Correct 11 ms 636 KB Output is correct
4 Correct 40 ms 596 KB Output is correct
5 Correct 46 ms 596 KB Output is correct
6 Correct 27 ms 596 KB Output is correct
7 Correct 7 ms 636 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 15 ms 596 KB Output is correct
10 Correct 28 ms 628 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 36 ms 632 KB Output is correct
13 Correct 11 ms 632 KB Output is correct
14 Correct 41 ms 596 KB Output is correct
15 Correct 45 ms 596 KB Output is correct
16 Correct 27 ms 596 KB Output is correct
17 Correct 7 ms 596 KB Output is correct
18 Correct 5 ms 596 KB Output is correct
19 Correct 16 ms 640 KB Output is correct
20 Correct 26 ms 596 KB Output is correct
21 Correct 9 ms 724 KB Output is correct
22 Correct 8 ms 724 KB Output is correct
23 Correct 153 ms 724 KB Output is correct
24 Correct 84 ms 816 KB Output is correct
25 Correct 173 ms 816 KB Output is correct
26 Correct 216 ms 724 KB Output is correct
27 Correct 171 ms 816 KB Output is correct
28 Correct 154 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 227 ms 812 KB Output is correct
7 Correct 86 ms 808 KB Output is correct
8 Correct 205 ms 816 KB Output is correct
9 Correct 351 ms 812 KB Output is correct
10 Correct 9 ms 724 KB Output is correct
11 Correct 8 ms 724 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 39 ms 596 KB Output is correct
14 Correct 11 ms 636 KB Output is correct
15 Correct 40 ms 596 KB Output is correct
16 Correct 46 ms 596 KB Output is correct
17 Correct 27 ms 596 KB Output is correct
18 Correct 7 ms 636 KB Output is correct
19 Correct 5 ms 632 KB Output is correct
20 Correct 15 ms 596 KB Output is correct
21 Correct 28 ms 628 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 42 ms 596 KB Output is correct
27 Correct 12 ms 596 KB Output is correct
28 Correct 43 ms 596 KB Output is correct
29 Correct 54 ms 596 KB Output is correct
30 Correct 27 ms 596 KB Output is correct
31 Correct 6 ms 596 KB Output is correct
32 Correct 6 ms 596 KB Output is correct
33 Correct 16 ms 636 KB Output is correct
34 Correct 27 ms 596 KB Output is correct
35 Correct 74 ms 624 KB Output is correct
36 Correct 29 ms 716 KB Output is correct
37 Correct 92 ms 612 KB Output is correct
38 Correct 63 ms 596 KB Output is correct
39 Correct 71 ms 596 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 36 ms 632 KB Output is correct
42 Correct 11 ms 632 KB Output is correct
43 Correct 41 ms 596 KB Output is correct
44 Correct 45 ms 596 KB Output is correct
45 Correct 27 ms 596 KB Output is correct
46 Correct 7 ms 596 KB Output is correct
47 Correct 5 ms 596 KB Output is correct
48 Correct 16 ms 640 KB Output is correct
49 Correct 26 ms 596 KB Output is correct
50 Correct 9 ms 724 KB Output is correct
51 Correct 8 ms 724 KB Output is correct
52 Correct 153 ms 724 KB Output is correct
53 Correct 84 ms 816 KB Output is correct
54 Correct 173 ms 816 KB Output is correct
55 Correct 216 ms 724 KB Output is correct
56 Correct 171 ms 816 KB Output is correct
57 Correct 154 ms 724 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 1 ms 340 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 340 KB Output is correct
62 Correct 0 ms 212 KB Output is correct
63 Correct 212 ms 724 KB Output is correct
64 Correct 84 ms 816 KB Output is correct
65 Correct 209 ms 808 KB Output is correct
66 Correct 340 ms 816 KB Output is correct
67 Correct 11 ms 828 KB Output is correct
68 Correct 8 ms 724 KB Output is correct
69 Correct 37 ms 596 KB Output is correct
70 Correct 12 ms 640 KB Output is correct
71 Correct 39 ms 616 KB Output is correct
72 Correct 46 ms 596 KB Output is correct
73 Correct 28 ms 596 KB Output is correct
74 Correct 7 ms 636 KB Output is correct
75 Correct 5 ms 636 KB Output is correct
76 Correct 15 ms 636 KB Output is correct
77 Correct 26 ms 640 KB Output is correct
78 Correct 72 ms 616 KB Output is correct
79 Correct 29 ms 596 KB Output is correct
80 Correct 91 ms 624 KB Output is correct
81 Correct 63 ms 596 KB Output is correct
82 Correct 74 ms 596 KB Output is correct
83 Correct 170 ms 724 KB Output is correct
84 Correct 83 ms 816 KB Output is correct
85 Correct 172 ms 808 KB Output is correct
86 Correct 237 ms 724 KB Output is correct
87 Correct 164 ms 844 KB Output is correct
88 Correct 165 ms 808 KB Output is correct
89 Correct 309 ms 808 KB Output is correct
90 Correct 443 ms 820 KB Output is correct
91 Correct 315 ms 812 KB Output is correct
92 Correct 350 ms 820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 39 ms 596 KB Output is correct
3 Correct 11 ms 636 KB Output is correct
4 Correct 40 ms 596 KB Output is correct
5 Correct 46 ms 596 KB Output is correct
6 Correct 27 ms 596 KB Output is correct
7 Correct 7 ms 636 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 15 ms 596 KB Output is correct
10 Correct 28 ms 628 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 36 ms 632 KB Output is correct
13 Correct 11 ms 632 KB Output is correct
14 Correct 41 ms 596 KB Output is correct
15 Correct 45 ms 596 KB Output is correct
16 Correct 27 ms 596 KB Output is correct
17 Correct 7 ms 596 KB Output is correct
18 Correct 5 ms 596 KB Output is correct
19 Correct 16 ms 640 KB Output is correct
20 Correct 26 ms 596 KB Output is correct
21 Correct 9 ms 724 KB Output is correct
22 Correct 8 ms 724 KB Output is correct
23 Correct 153 ms 724 KB Output is correct
24 Correct 84 ms 816 KB Output is correct
25 Correct 173 ms 816 KB Output is correct
26 Correct 216 ms 724 KB Output is correct
27 Correct 171 ms 816 KB Output is correct
28 Correct 154 ms 724 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 38 ms 612 KB Output is correct
31 Correct 11 ms 596 KB Output is correct
32 Correct 46 ms 612 KB Output is correct
33 Correct 57 ms 616 KB Output is correct
34 Correct 27 ms 596 KB Output is correct
35 Correct 7 ms 596 KB Output is correct
36 Correct 6 ms 636 KB Output is correct
37 Correct 16 ms 640 KB Output is correct
38 Correct 26 ms 632 KB Output is correct
39 Correct 9 ms 836 KB Output is correct
40 Correct 8 ms 724 KB Output is correct
41 Correct 155 ms 724 KB Output is correct
42 Correct 86 ms 848 KB Output is correct
43 Correct 160 ms 812 KB Output is correct
44 Correct 228 ms 812 KB Output is correct
45 Correct 189 ms 824 KB Output is correct
46 Correct 156 ms 812 KB Output is correct
47 Correct 38 ms 1236 KB Output is correct
48 Correct 34 ms 1236 KB Output is correct
49 Correct 1299 ms 1296 KB Output is correct
50 Correct 554 ms 1356 KB Output is correct
51 Correct 1533 ms 1312 KB Output is correct
52 Correct 1841 ms 1308 KB Output is correct
53 Correct 1273 ms 1300 KB Output is correct
54 Correct 1158 ms 1304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 227 ms 812 KB Output is correct
7 Correct 86 ms 808 KB Output is correct
8 Correct 205 ms 816 KB Output is correct
9 Correct 351 ms 812 KB Output is correct
10 Correct 9 ms 724 KB Output is correct
11 Correct 8 ms 724 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 312 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 218 ms 812 KB Output is correct
18 Correct 89 ms 816 KB Output is correct
19 Correct 220 ms 820 KB Output is correct
20 Correct 351 ms 816 KB Output is correct
21 Correct 9 ms 724 KB Output is correct
22 Correct 8 ms 724 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1726 ms 1256 KB Output is correct
25 Correct 563 ms 1304 KB Output is correct
26 Correct 2957 ms 1356 KB Output is correct
27 Correct 2907 ms 1356 KB Output is correct
28 Correct 39 ms 1236 KB Output is correct
29 Correct 34 ms 1236 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 39 ms 596 KB Output is correct
32 Correct 11 ms 636 KB Output is correct
33 Correct 40 ms 596 KB Output is correct
34 Correct 46 ms 596 KB Output is correct
35 Correct 27 ms 596 KB Output is correct
36 Correct 7 ms 636 KB Output is correct
37 Correct 5 ms 632 KB Output is correct
38 Correct 15 ms 596 KB Output is correct
39 Correct 28 ms 628 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 42 ms 596 KB Output is correct
45 Correct 12 ms 596 KB Output is correct
46 Correct 43 ms 596 KB Output is correct
47 Correct 54 ms 596 KB Output is correct
48 Correct 27 ms 596 KB Output is correct
49 Correct 6 ms 596 KB Output is correct
50 Correct 6 ms 596 KB Output is correct
51 Correct 16 ms 636 KB Output is correct
52 Correct 27 ms 596 KB Output is correct
53 Correct 74 ms 624 KB Output is correct
54 Correct 29 ms 716 KB Output is correct
55 Correct 92 ms 612 KB Output is correct
56 Correct 63 ms 596 KB Output is correct
57 Correct 71 ms 596 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 36 ms 632 KB Output is correct
60 Correct 11 ms 632 KB Output is correct
61 Correct 41 ms 596 KB Output is correct
62 Correct 45 ms 596 KB Output is correct
63 Correct 27 ms 596 KB Output is correct
64 Correct 7 ms 596 KB Output is correct
65 Correct 5 ms 596 KB Output is correct
66 Correct 16 ms 640 KB Output is correct
67 Correct 26 ms 596 KB Output is correct
68 Correct 9 ms 724 KB Output is correct
69 Correct 8 ms 724 KB Output is correct
70 Correct 153 ms 724 KB Output is correct
71 Correct 84 ms 816 KB Output is correct
72 Correct 173 ms 816 KB Output is correct
73 Correct 216 ms 724 KB Output is correct
74 Correct 171 ms 816 KB Output is correct
75 Correct 154 ms 724 KB Output is correct
76 Correct 1 ms 340 KB Output is correct
77 Correct 1 ms 340 KB Output is correct
78 Correct 1 ms 340 KB Output is correct
79 Correct 2 ms 340 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 212 ms 724 KB Output is correct
82 Correct 84 ms 816 KB Output is correct
83 Correct 209 ms 808 KB Output is correct
84 Correct 340 ms 816 KB Output is correct
85 Correct 11 ms 828 KB Output is correct
86 Correct 8 ms 724 KB Output is correct
87 Correct 37 ms 596 KB Output is correct
88 Correct 12 ms 640 KB Output is correct
89 Correct 39 ms 616 KB Output is correct
90 Correct 46 ms 596 KB Output is correct
91 Correct 28 ms 596 KB Output is correct
92 Correct 7 ms 636 KB Output is correct
93 Correct 5 ms 636 KB Output is correct
94 Correct 15 ms 636 KB Output is correct
95 Correct 26 ms 640 KB Output is correct
96 Correct 72 ms 616 KB Output is correct
97 Correct 29 ms 596 KB Output is correct
98 Correct 91 ms 624 KB Output is correct
99 Correct 63 ms 596 KB Output is correct
100 Correct 74 ms 596 KB Output is correct
101 Correct 170 ms 724 KB Output is correct
102 Correct 83 ms 816 KB Output is correct
103 Correct 172 ms 808 KB Output is correct
104 Correct 237 ms 724 KB Output is correct
105 Correct 164 ms 844 KB Output is correct
106 Correct 165 ms 808 KB Output is correct
107 Correct 309 ms 808 KB Output is correct
108 Correct 443 ms 820 KB Output is correct
109 Correct 315 ms 812 KB Output is correct
110 Correct 350 ms 820 KB Output is correct
111 Correct 1 ms 340 KB Output is correct
112 Correct 38 ms 612 KB Output is correct
113 Correct 11 ms 596 KB Output is correct
114 Correct 46 ms 612 KB Output is correct
115 Correct 57 ms 616 KB Output is correct
116 Correct 27 ms 596 KB Output is correct
117 Correct 7 ms 596 KB Output is correct
118 Correct 6 ms 636 KB Output is correct
119 Correct 16 ms 640 KB Output is correct
120 Correct 26 ms 632 KB Output is correct
121 Correct 9 ms 836 KB Output is correct
122 Correct 8 ms 724 KB Output is correct
123 Correct 155 ms 724 KB Output is correct
124 Correct 86 ms 848 KB Output is correct
125 Correct 160 ms 812 KB Output is correct
126 Correct 228 ms 812 KB Output is correct
127 Correct 189 ms 824 KB Output is correct
128 Correct 156 ms 812 KB Output is correct
129 Correct 38 ms 1236 KB Output is correct
130 Correct 34 ms 1236 KB Output is correct
131 Correct 1299 ms 1296 KB Output is correct
132 Correct 554 ms 1356 KB Output is correct
133 Correct 1533 ms 1312 KB Output is correct
134 Correct 1841 ms 1308 KB Output is correct
135 Correct 1273 ms 1300 KB Output is correct
136 Correct 1158 ms 1304 KB Output is correct
137 Correct 1 ms 340 KB Output is correct
138 Correct 1 ms 308 KB Output is correct
139 Correct 1 ms 340 KB Output is correct
140 Correct 2 ms 340 KB Output is correct
141 Correct 1 ms 212 KB Output is correct
142 Correct 237 ms 808 KB Output is correct
143 Correct 89 ms 808 KB Output is correct
144 Correct 220 ms 812 KB Output is correct
145 Correct 366 ms 812 KB Output is correct
146 Correct 10 ms 828 KB Output is correct
147 Correct 8 ms 724 KB Output is correct
148 Correct 1 ms 212 KB Output is correct
149 Correct 1755 ms 1304 KB Output is correct
150 Correct 602 ms 1304 KB Output is correct
151 Correct 3322 ms 1300 KB Output is correct
152 Correct 3141 ms 1304 KB Output is correct
153 Correct 37 ms 1236 KB Output is correct
154 Correct 35 ms 1236 KB Output is correct
155 Correct 37 ms 596 KB Output is correct
156 Correct 10 ms 596 KB Output is correct
157 Correct 39 ms 596 KB Output is correct
158 Correct 45 ms 596 KB Output is correct
159 Correct 28 ms 640 KB Output is correct
160 Correct 6 ms 632 KB Output is correct
161 Correct 5 ms 596 KB Output is correct
162 Correct 16 ms 628 KB Output is correct
163 Correct 26 ms 596 KB Output is correct
164 Correct 149 ms 820 KB Output is correct
165 Correct 84 ms 724 KB Output is correct
166 Correct 161 ms 812 KB Output is correct
167 Correct 217 ms 808 KB Output is correct
168 Correct 180 ms 812 KB Output is correct
169 Correct 156 ms 724 KB Output is correct
170 Correct 76 ms 596 KB Output is correct
171 Correct 32 ms 616 KB Output is correct
172 Correct 86 ms 596 KB Output is correct
173 Correct 61 ms 616 KB Output is correct
174 Correct 75 ms 596 KB Output is correct
175 Correct 318 ms 812 KB Output is correct
176 Correct 431 ms 816 KB Output is correct
177 Correct 321 ms 724 KB Output is correct
178 Correct 331 ms 824 KB Output is correct
179 Correct 1364 ms 1300 KB Output is correct
180 Correct 572 ms 1236 KB Output is correct
181 Correct 1524 ms 1296 KB Output is correct
182 Correct 1800 ms 1356 KB Output is correct
183 Correct 1221 ms 1308 KB Output is correct
184 Correct 1049 ms 1236 KB Output is correct
185 Correct 2584 ms 1300 KB Output is correct
186 Correct 3547 ms 1236 KB Output is correct
187 Correct 2508 ms 1300 KB Output is correct
188 Correct 2552 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 39 ms 596 KB Output is correct
3 Correct 11 ms 636 KB Output is correct
4 Correct 40 ms 596 KB Output is correct
5 Correct 46 ms 596 KB Output is correct
6 Correct 27 ms 596 KB Output is correct
7 Correct 7 ms 636 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 15 ms 596 KB Output is correct
10 Correct 28 ms 628 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 36 ms 632 KB Output is correct
13 Correct 11 ms 632 KB Output is correct
14 Correct 41 ms 596 KB Output is correct
15 Correct 45 ms 596 KB Output is correct
16 Correct 27 ms 596 KB Output is correct
17 Correct 7 ms 596 KB Output is correct
18 Correct 5 ms 596 KB Output is correct
19 Correct 16 ms 640 KB Output is correct
20 Correct 26 ms 596 KB Output is correct
21 Correct 9 ms 724 KB Output is correct
22 Correct 8 ms 724 KB Output is correct
23 Correct 153 ms 724 KB Output is correct
24 Correct 84 ms 816 KB Output is correct
25 Correct 173 ms 816 KB Output is correct
26 Correct 216 ms 724 KB Output is correct
27 Correct 171 ms 816 KB Output is correct
28 Correct 154 ms 724 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 38 ms 612 KB Output is correct
31 Correct 11 ms 596 KB Output is correct
32 Correct 46 ms 612 KB Output is correct
33 Correct 57 ms 616 KB Output is correct
34 Correct 27 ms 596 KB Output is correct
35 Correct 7 ms 596 KB Output is correct
36 Correct 6 ms 636 KB Output is correct
37 Correct 16 ms 640 KB Output is correct
38 Correct 26 ms 632 KB Output is correct
39 Correct 9 ms 836 KB Output is correct
40 Correct 8 ms 724 KB Output is correct
41 Correct 155 ms 724 KB Output is correct
42 Correct 86 ms 848 KB Output is correct
43 Correct 160 ms 812 KB Output is correct
44 Correct 228 ms 812 KB Output is correct
45 Correct 189 ms 824 KB Output is correct
46 Correct 156 ms 812 KB Output is correct
47 Correct 38 ms 1236 KB Output is correct
48 Correct 34 ms 1236 KB Output is correct
49 Correct 1299 ms 1296 KB Output is correct
50 Correct 554 ms 1356 KB Output is correct
51 Correct 1533 ms 1312 KB Output is correct
52 Correct 1841 ms 1308 KB Output is correct
53 Correct 1273 ms 1300 KB Output is correct
54 Correct 1158 ms 1304 KB Output is correct
55 Correct 2 ms 340 KB Output is correct
56 Correct 38 ms 596 KB Output is correct
57 Correct 12 ms 640 KB Output is correct
58 Correct 46 ms 632 KB Output is correct
59 Correct 52 ms 616 KB Output is correct
60 Correct 26 ms 596 KB Output is correct
61 Correct 7 ms 640 KB Output is correct
62 Correct 5 ms 596 KB Output is correct
63 Correct 15 ms 636 KB Output is correct
64 Correct 25 ms 596 KB Output is correct
65 Correct 9 ms 724 KB Output is correct
66 Correct 8 ms 832 KB Output is correct
67 Correct 159 ms 824 KB Output is correct
68 Correct 81 ms 812 KB Output is correct
69 Correct 157 ms 808 KB Output is correct
70 Correct 219 ms 816 KB Output is correct
71 Correct 168 ms 712 KB Output is correct
72 Correct 155 ms 724 KB Output is correct
73 Correct 36 ms 1236 KB Output is correct
74 Correct 34 ms 1236 KB Output is correct
75 Correct 1277 ms 1236 KB Output is correct
76 Correct 566 ms 1300 KB Output is correct
77 Correct 1542 ms 1308 KB Output is correct
78 Correct 1817 ms 1300 KB Output is correct
79 Correct 1225 ms 1304 KB Output is correct
80 Correct 1070 ms 1300 KB Output is correct
81 Execution timed out 5051 ms 3156 KB Time limit exceeded
82 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 227 ms 812 KB Output is correct
7 Correct 86 ms 808 KB Output is correct
8 Correct 205 ms 816 KB Output is correct
9 Correct 351 ms 812 KB Output is correct
10 Correct 9 ms 724 KB Output is correct
11 Correct 8 ms 724 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 312 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 218 ms 812 KB Output is correct
18 Correct 89 ms 816 KB Output is correct
19 Correct 220 ms 820 KB Output is correct
20 Correct 351 ms 816 KB Output is correct
21 Correct 9 ms 724 KB Output is correct
22 Correct 8 ms 724 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1726 ms 1256 KB Output is correct
25 Correct 563 ms 1304 KB Output is correct
26 Correct 2957 ms 1356 KB Output is correct
27 Correct 2907 ms 1356 KB Output is correct
28 Correct 39 ms 1236 KB Output is correct
29 Correct 34 ms 1236 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 39 ms 596 KB Output is correct
32 Correct 11 ms 636 KB Output is correct
33 Correct 40 ms 596 KB Output is correct
34 Correct 46 ms 596 KB Output is correct
35 Correct 27 ms 596 KB Output is correct
36 Correct 7 ms 636 KB Output is correct
37 Correct 5 ms 632 KB Output is correct
38 Correct 15 ms 596 KB Output is correct
39 Correct 28 ms 628 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 42 ms 596 KB Output is correct
45 Correct 12 ms 596 KB Output is correct
46 Correct 43 ms 596 KB Output is correct
47 Correct 54 ms 596 KB Output is correct
48 Correct 27 ms 596 KB Output is correct
49 Correct 6 ms 596 KB Output is correct
50 Correct 6 ms 596 KB Output is correct
51 Correct 16 ms 636 KB Output is correct
52 Correct 27 ms 596 KB Output is correct
53 Correct 74 ms 624 KB Output is correct
54 Correct 29 ms 716 KB Output is correct
55 Correct 92 ms 612 KB Output is correct
56 Correct 63 ms 596 KB Output is correct
57 Correct 71 ms 596 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 36 ms 632 KB Output is correct
60 Correct 11 ms 632 KB Output is correct
61 Correct 41 ms 596 KB Output is correct
62 Correct 45 ms 596 KB Output is correct
63 Correct 27 ms 596 KB Output is correct
64 Correct 7 ms 596 KB Output is correct
65 Correct 5 ms 596 KB Output is correct
66 Correct 16 ms 640 KB Output is correct
67 Correct 26 ms 596 KB Output is correct
68 Correct 9 ms 724 KB Output is correct
69 Correct 8 ms 724 KB Output is correct
70 Correct 153 ms 724 KB Output is correct
71 Correct 84 ms 816 KB Output is correct
72 Correct 173 ms 816 KB Output is correct
73 Correct 216 ms 724 KB Output is correct
74 Correct 171 ms 816 KB Output is correct
75 Correct 154 ms 724 KB Output is correct
76 Correct 1 ms 340 KB Output is correct
77 Correct 1 ms 340 KB Output is correct
78 Correct 1 ms 340 KB Output is correct
79 Correct 2 ms 340 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 212 ms 724 KB Output is correct
82 Correct 84 ms 816 KB Output is correct
83 Correct 209 ms 808 KB Output is correct
84 Correct 340 ms 816 KB Output is correct
85 Correct 11 ms 828 KB Output is correct
86 Correct 8 ms 724 KB Output is correct
87 Correct 37 ms 596 KB Output is correct
88 Correct 12 ms 640 KB Output is correct
89 Correct 39 ms 616 KB Output is correct
90 Correct 46 ms 596 KB Output is correct
91 Correct 28 ms 596 KB Output is correct
92 Correct 7 ms 636 KB Output is correct
93 Correct 5 ms 636 KB Output is correct
94 Correct 15 ms 636 KB Output is correct
95 Correct 26 ms 640 KB Output is correct
96 Correct 72 ms 616 KB Output is correct
97 Correct 29 ms 596 KB Output is correct
98 Correct 91 ms 624 KB Output is correct
99 Correct 63 ms 596 KB Output is correct
100 Correct 74 ms 596 KB Output is correct
101 Correct 170 ms 724 KB Output is correct
102 Correct 83 ms 816 KB Output is correct
103 Correct 172 ms 808 KB Output is correct
104 Correct 237 ms 724 KB Output is correct
105 Correct 164 ms 844 KB Output is correct
106 Correct 165 ms 808 KB Output is correct
107 Correct 309 ms 808 KB Output is correct
108 Correct 443 ms 820 KB Output is correct
109 Correct 315 ms 812 KB Output is correct
110 Correct 350 ms 820 KB Output is correct
111 Correct 1 ms 340 KB Output is correct
112 Correct 38 ms 612 KB Output is correct
113 Correct 11 ms 596 KB Output is correct
114 Correct 46 ms 612 KB Output is correct
115 Correct 57 ms 616 KB Output is correct
116 Correct 27 ms 596 KB Output is correct
117 Correct 7 ms 596 KB Output is correct
118 Correct 6 ms 636 KB Output is correct
119 Correct 16 ms 640 KB Output is correct
120 Correct 26 ms 632 KB Output is correct
121 Correct 9 ms 836 KB Output is correct
122 Correct 8 ms 724 KB Output is correct
123 Correct 155 ms 724 KB Output is correct
124 Correct 86 ms 848 KB Output is correct
125 Correct 160 ms 812 KB Output is correct
126 Correct 228 ms 812 KB Output is correct
127 Correct 189 ms 824 KB Output is correct
128 Correct 156 ms 812 KB Output is correct
129 Correct 38 ms 1236 KB Output is correct
130 Correct 34 ms 1236 KB Output is correct
131 Correct 1299 ms 1296 KB Output is correct
132 Correct 554 ms 1356 KB Output is correct
133 Correct 1533 ms 1312 KB Output is correct
134 Correct 1841 ms 1308 KB Output is correct
135 Correct 1273 ms 1300 KB Output is correct
136 Correct 1158 ms 1304 KB Output is correct
137 Correct 1 ms 340 KB Output is correct
138 Correct 1 ms 308 KB Output is correct
139 Correct 1 ms 340 KB Output is correct
140 Correct 2 ms 340 KB Output is correct
141 Correct 1 ms 212 KB Output is correct
142 Correct 237 ms 808 KB Output is correct
143 Correct 89 ms 808 KB Output is correct
144 Correct 220 ms 812 KB Output is correct
145 Correct 366 ms 812 KB Output is correct
146 Correct 10 ms 828 KB Output is correct
147 Correct 8 ms 724 KB Output is correct
148 Correct 1 ms 212 KB Output is correct
149 Correct 1755 ms 1304 KB Output is correct
150 Correct 602 ms 1304 KB Output is correct
151 Correct 3322 ms 1300 KB Output is correct
152 Correct 3141 ms 1304 KB Output is correct
153 Correct 37 ms 1236 KB Output is correct
154 Correct 35 ms 1236 KB Output is correct
155 Correct 37 ms 596 KB Output is correct
156 Correct 10 ms 596 KB Output is correct
157 Correct 39 ms 596 KB Output is correct
158 Correct 45 ms 596 KB Output is correct
159 Correct 28 ms 640 KB Output is correct
160 Correct 6 ms 632 KB Output is correct
161 Correct 5 ms 596 KB Output is correct
162 Correct 16 ms 628 KB Output is correct
163 Correct 26 ms 596 KB Output is correct
164 Correct 149 ms 820 KB Output is correct
165 Correct 84 ms 724 KB Output is correct
166 Correct 161 ms 812 KB Output is correct
167 Correct 217 ms 808 KB Output is correct
168 Correct 180 ms 812 KB Output is correct
169 Correct 156 ms 724 KB Output is correct
170 Correct 76 ms 596 KB Output is correct
171 Correct 32 ms 616 KB Output is correct
172 Correct 86 ms 596 KB Output is correct
173 Correct 61 ms 616 KB Output is correct
174 Correct 75 ms 596 KB Output is correct
175 Correct 318 ms 812 KB Output is correct
176 Correct 431 ms 816 KB Output is correct
177 Correct 321 ms 724 KB Output is correct
178 Correct 331 ms 824 KB Output is correct
179 Correct 1364 ms 1300 KB Output is correct
180 Correct 572 ms 1236 KB Output is correct
181 Correct 1524 ms 1296 KB Output is correct
182 Correct 1800 ms 1356 KB Output is correct
183 Correct 1221 ms 1308 KB Output is correct
184 Correct 1049 ms 1236 KB Output is correct
185 Correct 2584 ms 1300 KB Output is correct
186 Correct 3547 ms 1236 KB Output is correct
187 Correct 2508 ms 1300 KB Output is correct
188 Correct 2552 ms 1356 KB Output is correct
189 Correct 2 ms 340 KB Output is correct
190 Correct 38 ms 596 KB Output is correct
191 Correct 12 ms 640 KB Output is correct
192 Correct 46 ms 632 KB Output is correct
193 Correct 52 ms 616 KB Output is correct
194 Correct 26 ms 596 KB Output is correct
195 Correct 7 ms 640 KB Output is correct
196 Correct 5 ms 596 KB Output is correct
197 Correct 15 ms 636 KB Output is correct
198 Correct 25 ms 596 KB Output is correct
199 Correct 9 ms 724 KB Output is correct
200 Correct 8 ms 832 KB Output is correct
201 Correct 159 ms 824 KB Output is correct
202 Correct 81 ms 812 KB Output is correct
203 Correct 157 ms 808 KB Output is correct
204 Correct 219 ms 816 KB Output is correct
205 Correct 168 ms 712 KB Output is correct
206 Correct 155 ms 724 KB Output is correct
207 Correct 36 ms 1236 KB Output is correct
208 Correct 34 ms 1236 KB Output is correct
209 Correct 1277 ms 1236 KB Output is correct
210 Correct 566 ms 1300 KB Output is correct
211 Correct 1542 ms 1308 KB Output is correct
212 Correct 1817 ms 1300 KB Output is correct
213 Correct 1225 ms 1304 KB Output is correct
214 Correct 1070 ms 1300 KB Output is correct
215 Execution timed out 5051 ms 3156 KB Time limit exceeded
216 Halted 0 ms 0 KB -