Submission #1070973

# Submission time Handle Problem Language Result Execution time Memory
1070973 2024-08-22T22:04:32 Z AdamGS Uplifting Excursion (BOI22_vault) C++17
90 / 100
5000 ms 71988 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const ll INF=1e18+7;
const ll LIM=1e6+7;
vector<int>V[LIM];
ll dp[LIM], dp2[LIM], A[LIM], B[LIM], l[LIM], sz[LIM];
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll n, m;
	cin >> n >> m;
	rep(i, n) cin >> A[n-i];
	rep(i, n+1) cin >> B[i];
	ll ans=0;
	rep(i, n+1) ans+=B[i];
	rep(i, n+1) ans+=A[i];
	rep(i, n+1) m+=A[i]*(ll)i;
	rep(i, n+1) m-=B[i]*(ll)i;
	if(m<0) {
		m*=-1;
		rep(i, n+1) swap(A[i], B[i]);
	}
	rep(i, LIM) dp[i]=INF;
	dp[0]=0;
	int ile=1;
	for(ll i=n; i; --i) {
		if(m>=LIM/2) {
			ll p=m-LIM/2;
			p=(p+i-1)/i;
			p=min(p, max(A[i]-300/ile, 0ll));
			A[i]-=p;
			if(A[i]) ++ile;
			dp[0]+=p;
			m-=p*i;	
		}
	}
	if(m>=LIM) {
		cout << "impossible\n";
		return 0;
	}
	for(int i=1; i<=n; ++i) rep(j, LIM/i+1) V[i-1].pb(0);
	rep(xd, 2) {
		for(ll i=1; i<=n; ++i) if(A[i]) {
			rep(j, i) l[j]=sz[j]=0;
			rep(j, LIM) {
				ll p=j%i;
				while(l[p]<sz[p] && (j-V[p][l[p]])/i>A[i]) ++l[p];
				while(sz[p]>0 && dp[j]<=dp[V[p][sz[p]-1]]+(j-V[p][sz[p]-1])/i) {
					--sz[p];
					l[p]=min(l[p], sz[p]);
				}
				dp2[j]=dp[j];
				if(l[p]<sz[p]) dp2[j]=min(dp2[j], dp[V[p][l[p]]]+(j-V[p][l[p]])/i);
				V[p][sz[p]]=j;
				++sz[p];
			}
			rep(j, LIM) dp[j]=dp2[j];
		}
		rep(i, LIM/2) swap(dp[i], dp[LIM-i-1]);
		rep(i, n+1) swap(A[i], B[i]);
	}
	if(dp[m]==INF) {
		cout << "impossible\n";
		return 0;
	}
	cout << ans-dp[m] << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 48 ms 53968 KB Output is correct
2 Correct 46 ms 55244 KB Output is correct
3 Correct 20 ms 50128 KB Output is correct
4 Correct 105 ms 58180 KB Output is correct
5 Correct 5 ms 37720 KB Output is correct
6 Correct 972 ms 63952 KB Output is correct
7 Correct 425 ms 63952 KB Output is correct
8 Correct 968 ms 64144 KB Output is correct
9 Correct 983 ms 64148 KB Output is correct
10 Correct 44 ms 63952 KB Output is correct
11 Correct 81 ms 63948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 53968 KB Output is correct
2 Correct 46 ms 55244 KB Output is correct
3 Correct 20 ms 50128 KB Output is correct
4 Correct 105 ms 58180 KB Output is correct
5 Correct 5 ms 37720 KB Output is correct
6 Correct 972 ms 63952 KB Output is correct
7 Correct 425 ms 63952 KB Output is correct
8 Correct 968 ms 64144 KB Output is correct
9 Correct 983 ms 64148 KB Output is correct
10 Correct 44 ms 63952 KB Output is correct
11 Correct 81 ms 63948 KB Output is correct
12 Correct 48 ms 53968 KB Output is correct
13 Correct 40 ms 55248 KB Output is correct
14 Correct 20 ms 50124 KB Output is correct
15 Correct 106 ms 58060 KB Output is correct
16 Correct 7 ms 37720 KB Output is correct
17 Correct 952 ms 63940 KB Output is correct
18 Correct 429 ms 63952 KB Output is correct
19 Correct 957 ms 64140 KB Output is correct
20 Correct 984 ms 64408 KB Output is correct
21 Correct 42 ms 63948 KB Output is correct
22 Correct 66 ms 64120 KB Output is correct
23 Correct 5 ms 37720 KB Output is correct
24 Correct 2069 ms 67028 KB Output is correct
25 Correct 862 ms 67012 KB Output is correct
26 Correct 2124 ms 67028 KB Output is correct
27 Correct 2200 ms 67008 KB Output is correct
28 Correct 50 ms 66776 KB Output is correct
29 Correct 80 ms 66892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 58004 KB Output is correct
2 Correct 442 ms 62140 KB Output is correct
3 Correct 137 ms 62160 KB Output is correct
4 Correct 450 ms 62076 KB Output is correct
5 Correct 470 ms 62148 KB Output is correct
6 Correct 467 ms 55760 KB Output is correct
7 Correct 52 ms 58056 KB Output is correct
8 Correct 77 ms 60624 KB Output is correct
9 Correct 292 ms 55732 KB Output is correct
10 Correct 323 ms 55728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 58004 KB Output is correct
2 Correct 442 ms 62140 KB Output is correct
3 Correct 137 ms 62160 KB Output is correct
4 Correct 450 ms 62076 KB Output is correct
5 Correct 470 ms 62148 KB Output is correct
6 Correct 467 ms 55760 KB Output is correct
7 Correct 52 ms 58056 KB Output is correct
8 Correct 77 ms 60624 KB Output is correct
9 Correct 292 ms 55732 KB Output is correct
10 Correct 323 ms 55728 KB Output is correct
11 Correct 52 ms 53964 KB Output is correct
12 Correct 53 ms 55236 KB Output is correct
13 Correct 21 ms 50128 KB Output is correct
14 Correct 108 ms 58064 KB Output is correct
15 Correct 444 ms 62152 KB Output is correct
16 Correct 132 ms 62156 KB Output is correct
17 Correct 427 ms 62200 KB Output is correct
18 Correct 446 ms 62204 KB Output is correct
19 Correct 453 ms 62160 KB Output is correct
20 Correct 44 ms 62152 KB Output is correct
21 Correct 69 ms 62148 KB Output is correct
22 Correct 277 ms 62200 KB Output is correct
23 Correct 301 ms 62924 KB Output is correct
24 Correct 651 ms 62152 KB Output is correct
25 Correct 254 ms 62160 KB Output is correct
26 Correct 653 ms 62208 KB Output is correct
27 Correct 632 ms 62200 KB Output is correct
28 Correct 654 ms 63088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 58004 KB Output is correct
2 Correct 442 ms 62140 KB Output is correct
3 Correct 137 ms 62160 KB Output is correct
4 Correct 450 ms 62076 KB Output is correct
5 Correct 470 ms 62148 KB Output is correct
6 Correct 467 ms 55760 KB Output is correct
7 Correct 52 ms 58056 KB Output is correct
8 Correct 77 ms 60624 KB Output is correct
9 Correct 292 ms 55732 KB Output is correct
10 Correct 323 ms 55728 KB Output is correct
11 Correct 110 ms 58060 KB Output is correct
12 Correct 421 ms 63040 KB Output is correct
13 Correct 134 ms 62160 KB Output is correct
14 Correct 423 ms 62200 KB Output is correct
15 Correct 431 ms 62400 KB Output is correct
16 Correct 452 ms 62204 KB Output is correct
17 Correct 48 ms 62148 KB Output is correct
18 Correct 67 ms 62156 KB Output is correct
19 Correct 258 ms 62148 KB Output is correct
20 Correct 311 ms 62204 KB Output is correct
21 Correct 43 ms 63924 KB Output is correct
22 Correct 68 ms 64204 KB Output is correct
23 Correct 700 ms 64144 KB Output is correct
24 Correct 314 ms 64044 KB Output is correct
25 Correct 721 ms 63944 KB Output is correct
26 Correct 710 ms 64152 KB Output is correct
27 Correct 736 ms 63944 KB Output is correct
28 Correct 542 ms 64144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 53968 KB Output is correct
2 Correct 46 ms 55244 KB Output is correct
3 Correct 20 ms 50128 KB Output is correct
4 Correct 105 ms 58180 KB Output is correct
5 Correct 5 ms 37720 KB Output is correct
6 Correct 972 ms 63952 KB Output is correct
7 Correct 425 ms 63952 KB Output is correct
8 Correct 968 ms 64144 KB Output is correct
9 Correct 983 ms 64148 KB Output is correct
10 Correct 44 ms 63952 KB Output is correct
11 Correct 81 ms 63948 KB Output is correct
12 Correct 112 ms 58004 KB Output is correct
13 Correct 442 ms 62140 KB Output is correct
14 Correct 137 ms 62160 KB Output is correct
15 Correct 450 ms 62076 KB Output is correct
16 Correct 470 ms 62148 KB Output is correct
17 Correct 467 ms 55760 KB Output is correct
18 Correct 52 ms 58056 KB Output is correct
19 Correct 77 ms 60624 KB Output is correct
20 Correct 292 ms 55732 KB Output is correct
21 Correct 323 ms 55728 KB Output is correct
22 Correct 52 ms 53964 KB Output is correct
23 Correct 53 ms 55236 KB Output is correct
24 Correct 21 ms 50128 KB Output is correct
25 Correct 108 ms 58064 KB Output is correct
26 Correct 444 ms 62152 KB Output is correct
27 Correct 132 ms 62156 KB Output is correct
28 Correct 427 ms 62200 KB Output is correct
29 Correct 446 ms 62204 KB Output is correct
30 Correct 453 ms 62160 KB Output is correct
31 Correct 44 ms 62152 KB Output is correct
32 Correct 69 ms 62148 KB Output is correct
33 Correct 277 ms 62200 KB Output is correct
34 Correct 301 ms 62924 KB Output is correct
35 Correct 651 ms 62152 KB Output is correct
36 Correct 254 ms 62160 KB Output is correct
37 Correct 653 ms 62208 KB Output is correct
38 Correct 632 ms 62200 KB Output is correct
39 Correct 654 ms 63088 KB Output is correct
40 Correct 110 ms 58060 KB Output is correct
41 Correct 421 ms 63040 KB Output is correct
42 Correct 134 ms 62160 KB Output is correct
43 Correct 423 ms 62200 KB Output is correct
44 Correct 431 ms 62400 KB Output is correct
45 Correct 452 ms 62204 KB Output is correct
46 Correct 48 ms 62148 KB Output is correct
47 Correct 67 ms 62156 KB Output is correct
48 Correct 258 ms 62148 KB Output is correct
49 Correct 311 ms 62204 KB Output is correct
50 Correct 43 ms 63924 KB Output is correct
51 Correct 68 ms 64204 KB Output is correct
52 Correct 700 ms 64144 KB Output is correct
53 Correct 314 ms 64044 KB Output is correct
54 Correct 721 ms 63944 KB Output is correct
55 Correct 710 ms 64152 KB Output is correct
56 Correct 736 ms 63944 KB Output is correct
57 Correct 542 ms 64144 KB Output is correct
58 Correct 50 ms 53968 KB Output is correct
59 Correct 44 ms 55244 KB Output is correct
60 Correct 22 ms 50124 KB Output is correct
61 Correct 110 ms 58052 KB Output is correct
62 Correct 5 ms 37728 KB Output is correct
63 Correct 990 ms 64144 KB Output is correct
64 Correct 432 ms 63944 KB Output is correct
65 Correct 947 ms 63952 KB Output is correct
66 Correct 1010 ms 63944 KB Output is correct
67 Correct 42 ms 63984 KB Output is correct
68 Correct 74 ms 63948 KB Output is correct
69 Correct 418 ms 62200 KB Output is correct
70 Correct 131 ms 62148 KB Output is correct
71 Correct 423 ms 62208 KB Output is correct
72 Correct 437 ms 62404 KB Output is correct
73 Correct 439 ms 62224 KB Output is correct
74 Correct 45 ms 62156 KB Output is correct
75 Correct 69 ms 62208 KB Output is correct
76 Correct 285 ms 62152 KB Output is correct
77 Correct 304 ms 62148 KB Output is correct
78 Correct 650 ms 62204 KB Output is correct
79 Correct 253 ms 62148 KB Output is correct
80 Correct 648 ms 62200 KB Output is correct
81 Correct 634 ms 62360 KB Output is correct
82 Correct 642 ms 62204 KB Output is correct
83 Correct 707 ms 64144 KB Output is correct
84 Correct 309 ms 64144 KB Output is correct
85 Correct 687 ms 63932 KB Output is correct
86 Correct 693 ms 63952 KB Output is correct
87 Correct 714 ms 64144 KB Output is correct
88 Correct 537 ms 64148 KB Output is correct
89 Correct 1090 ms 64980 KB Output is correct
90 Correct 1100 ms 63932 KB Output is correct
91 Correct 1055 ms 64144 KB Output is correct
92 Correct 1088 ms 64980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 58004 KB Output is correct
2 Correct 442 ms 62140 KB Output is correct
3 Correct 137 ms 62160 KB Output is correct
4 Correct 450 ms 62076 KB Output is correct
5 Correct 470 ms 62148 KB Output is correct
6 Correct 467 ms 55760 KB Output is correct
7 Correct 52 ms 58056 KB Output is correct
8 Correct 77 ms 60624 KB Output is correct
9 Correct 292 ms 55732 KB Output is correct
10 Correct 323 ms 55728 KB Output is correct
11 Correct 110 ms 58060 KB Output is correct
12 Correct 421 ms 63040 KB Output is correct
13 Correct 134 ms 62160 KB Output is correct
14 Correct 423 ms 62200 KB Output is correct
15 Correct 431 ms 62400 KB Output is correct
16 Correct 452 ms 62204 KB Output is correct
17 Correct 48 ms 62148 KB Output is correct
18 Correct 67 ms 62156 KB Output is correct
19 Correct 258 ms 62148 KB Output is correct
20 Correct 311 ms 62204 KB Output is correct
21 Correct 43 ms 63924 KB Output is correct
22 Correct 68 ms 64204 KB Output is correct
23 Correct 700 ms 64144 KB Output is correct
24 Correct 314 ms 64044 KB Output is correct
25 Correct 721 ms 63944 KB Output is correct
26 Correct 710 ms 64152 KB Output is correct
27 Correct 736 ms 63944 KB Output is correct
28 Correct 542 ms 64144 KB Output is correct
29 Correct 109 ms 58304 KB Output is correct
30 Correct 417 ms 62112 KB Output is correct
31 Correct 132 ms 62152 KB Output is correct
32 Correct 417 ms 62400 KB Output is correct
33 Correct 417 ms 62160 KB Output is correct
34 Correct 432 ms 62148 KB Output is correct
35 Correct 44 ms 62152 KB Output is correct
36 Correct 67 ms 62300 KB Output is correct
37 Correct 262 ms 62156 KB Output is correct
38 Correct 304 ms 62200 KB Output is correct
39 Correct 42 ms 64200 KB Output is correct
40 Correct 73 ms 64104 KB Output is correct
41 Correct 709 ms 64144 KB Output is correct
42 Correct 315 ms 64188 KB Output is correct
43 Correct 696 ms 63940 KB Output is correct
44 Correct 701 ms 64188 KB Output is correct
45 Correct 711 ms 64148 KB Output is correct
46 Correct 529 ms 63936 KB Output is correct
47 Correct 45 ms 67792 KB Output is correct
48 Correct 74 ms 67012 KB Output is correct
49 Correct 1428 ms 67272 KB Output is correct
50 Correct 678 ms 67168 KB Output is correct
51 Correct 1484 ms 67024 KB Output is correct
52 Correct 1488 ms 67032 KB Output is correct
53 Correct 1479 ms 67032 KB Output is correct
54 Correct 1249 ms 67024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 53968 KB Output is correct
2 Correct 46 ms 55244 KB Output is correct
3 Correct 20 ms 50128 KB Output is correct
4 Correct 105 ms 58180 KB Output is correct
5 Correct 5 ms 37720 KB Output is correct
6 Correct 972 ms 63952 KB Output is correct
7 Correct 425 ms 63952 KB Output is correct
8 Correct 968 ms 64144 KB Output is correct
9 Correct 983 ms 64148 KB Output is correct
10 Correct 44 ms 63952 KB Output is correct
11 Correct 81 ms 63948 KB Output is correct
12 Correct 48 ms 53968 KB Output is correct
13 Correct 40 ms 55248 KB Output is correct
14 Correct 20 ms 50124 KB Output is correct
15 Correct 106 ms 58060 KB Output is correct
16 Correct 7 ms 37720 KB Output is correct
17 Correct 952 ms 63940 KB Output is correct
18 Correct 429 ms 63952 KB Output is correct
19 Correct 957 ms 64140 KB Output is correct
20 Correct 984 ms 64408 KB Output is correct
21 Correct 42 ms 63948 KB Output is correct
22 Correct 66 ms 64120 KB Output is correct
23 Correct 5 ms 37720 KB Output is correct
24 Correct 2069 ms 67028 KB Output is correct
25 Correct 862 ms 67012 KB Output is correct
26 Correct 2124 ms 67028 KB Output is correct
27 Correct 2200 ms 67008 KB Output is correct
28 Correct 50 ms 66776 KB Output is correct
29 Correct 80 ms 66892 KB Output is correct
30 Correct 112 ms 58004 KB Output is correct
31 Correct 442 ms 62140 KB Output is correct
32 Correct 137 ms 62160 KB Output is correct
33 Correct 450 ms 62076 KB Output is correct
34 Correct 470 ms 62148 KB Output is correct
35 Correct 467 ms 55760 KB Output is correct
36 Correct 52 ms 58056 KB Output is correct
37 Correct 77 ms 60624 KB Output is correct
38 Correct 292 ms 55732 KB Output is correct
39 Correct 323 ms 55728 KB Output is correct
40 Correct 52 ms 53964 KB Output is correct
41 Correct 53 ms 55236 KB Output is correct
42 Correct 21 ms 50128 KB Output is correct
43 Correct 108 ms 58064 KB Output is correct
44 Correct 444 ms 62152 KB Output is correct
45 Correct 132 ms 62156 KB Output is correct
46 Correct 427 ms 62200 KB Output is correct
47 Correct 446 ms 62204 KB Output is correct
48 Correct 453 ms 62160 KB Output is correct
49 Correct 44 ms 62152 KB Output is correct
50 Correct 69 ms 62148 KB Output is correct
51 Correct 277 ms 62200 KB Output is correct
52 Correct 301 ms 62924 KB Output is correct
53 Correct 651 ms 62152 KB Output is correct
54 Correct 254 ms 62160 KB Output is correct
55 Correct 653 ms 62208 KB Output is correct
56 Correct 632 ms 62200 KB Output is correct
57 Correct 654 ms 63088 KB Output is correct
58 Correct 110 ms 58060 KB Output is correct
59 Correct 421 ms 63040 KB Output is correct
60 Correct 134 ms 62160 KB Output is correct
61 Correct 423 ms 62200 KB Output is correct
62 Correct 431 ms 62400 KB Output is correct
63 Correct 452 ms 62204 KB Output is correct
64 Correct 48 ms 62148 KB Output is correct
65 Correct 67 ms 62156 KB Output is correct
66 Correct 258 ms 62148 KB Output is correct
67 Correct 311 ms 62204 KB Output is correct
68 Correct 43 ms 63924 KB Output is correct
69 Correct 68 ms 64204 KB Output is correct
70 Correct 700 ms 64144 KB Output is correct
71 Correct 314 ms 64044 KB Output is correct
72 Correct 721 ms 63944 KB Output is correct
73 Correct 710 ms 64152 KB Output is correct
74 Correct 736 ms 63944 KB Output is correct
75 Correct 542 ms 64144 KB Output is correct
76 Correct 50 ms 53968 KB Output is correct
77 Correct 44 ms 55244 KB Output is correct
78 Correct 22 ms 50124 KB Output is correct
79 Correct 110 ms 58052 KB Output is correct
80 Correct 5 ms 37728 KB Output is correct
81 Correct 990 ms 64144 KB Output is correct
82 Correct 432 ms 63944 KB Output is correct
83 Correct 947 ms 63952 KB Output is correct
84 Correct 1010 ms 63944 KB Output is correct
85 Correct 42 ms 63984 KB Output is correct
86 Correct 74 ms 63948 KB Output is correct
87 Correct 418 ms 62200 KB Output is correct
88 Correct 131 ms 62148 KB Output is correct
89 Correct 423 ms 62208 KB Output is correct
90 Correct 437 ms 62404 KB Output is correct
91 Correct 439 ms 62224 KB Output is correct
92 Correct 45 ms 62156 KB Output is correct
93 Correct 69 ms 62208 KB Output is correct
94 Correct 285 ms 62152 KB Output is correct
95 Correct 304 ms 62148 KB Output is correct
96 Correct 650 ms 62204 KB Output is correct
97 Correct 253 ms 62148 KB Output is correct
98 Correct 648 ms 62200 KB Output is correct
99 Correct 634 ms 62360 KB Output is correct
100 Correct 642 ms 62204 KB Output is correct
101 Correct 707 ms 64144 KB Output is correct
102 Correct 309 ms 64144 KB Output is correct
103 Correct 687 ms 63932 KB Output is correct
104 Correct 693 ms 63952 KB Output is correct
105 Correct 714 ms 64144 KB Output is correct
106 Correct 537 ms 64148 KB Output is correct
107 Correct 1090 ms 64980 KB Output is correct
108 Correct 1100 ms 63932 KB Output is correct
109 Correct 1055 ms 64144 KB Output is correct
110 Correct 1088 ms 64980 KB Output is correct
111 Correct 109 ms 58304 KB Output is correct
112 Correct 417 ms 62112 KB Output is correct
113 Correct 132 ms 62152 KB Output is correct
114 Correct 417 ms 62400 KB Output is correct
115 Correct 417 ms 62160 KB Output is correct
116 Correct 432 ms 62148 KB Output is correct
117 Correct 44 ms 62152 KB Output is correct
118 Correct 67 ms 62300 KB Output is correct
119 Correct 262 ms 62156 KB Output is correct
120 Correct 304 ms 62200 KB Output is correct
121 Correct 42 ms 64200 KB Output is correct
122 Correct 73 ms 64104 KB Output is correct
123 Correct 709 ms 64144 KB Output is correct
124 Correct 315 ms 64188 KB Output is correct
125 Correct 696 ms 63940 KB Output is correct
126 Correct 701 ms 64188 KB Output is correct
127 Correct 711 ms 64148 KB Output is correct
128 Correct 529 ms 63936 KB Output is correct
129 Correct 45 ms 67792 KB Output is correct
130 Correct 74 ms 67012 KB Output is correct
131 Correct 1428 ms 67272 KB Output is correct
132 Correct 678 ms 67168 KB Output is correct
133 Correct 1484 ms 67024 KB Output is correct
134 Correct 1488 ms 67032 KB Output is correct
135 Correct 1479 ms 67032 KB Output is correct
136 Correct 1249 ms 67024 KB Output is correct
137 Correct 49 ms 53968 KB Output is correct
138 Correct 39 ms 55244 KB Output is correct
139 Correct 20 ms 50128 KB Output is correct
140 Correct 113 ms 57952 KB Output is correct
141 Correct 5 ms 37720 KB Output is correct
142 Correct 966 ms 64140 KB Output is correct
143 Correct 474 ms 64976 KB Output is correct
144 Correct 959 ms 64144 KB Output is correct
145 Correct 979 ms 64200 KB Output is correct
146 Correct 44 ms 63944 KB Output is correct
147 Correct 69 ms 64164 KB Output is correct
148 Correct 6 ms 37724 KB Output is correct
149 Correct 2039 ms 67028 KB Output is correct
150 Correct 834 ms 67012 KB Output is correct
151 Correct 2089 ms 67028 KB Output is correct
152 Correct 2090 ms 67028 KB Output is correct
153 Correct 49 ms 66772 KB Output is correct
154 Correct 80 ms 67012 KB Output is correct
155 Correct 425 ms 62148 KB Output is correct
156 Correct 134 ms 62404 KB Output is correct
157 Correct 437 ms 62152 KB Output is correct
158 Correct 429 ms 62208 KB Output is correct
159 Correct 439 ms 62148 KB Output is correct
160 Correct 54 ms 61988 KB Output is correct
161 Correct 72 ms 62152 KB Output is correct
162 Correct 267 ms 62152 KB Output is correct
163 Correct 309 ms 62156 KB Output is correct
164 Correct 708 ms 64052 KB Output is correct
165 Correct 349 ms 64192 KB Output is correct
166 Correct 710 ms 63940 KB Output is correct
167 Correct 724 ms 64140 KB Output is correct
168 Correct 732 ms 64016 KB Output is correct
169 Correct 562 ms 63948 KB Output is correct
170 Correct 641 ms 62144 KB Output is correct
171 Correct 275 ms 62152 KB Output is correct
172 Correct 670 ms 62204 KB Output is correct
173 Correct 651 ms 62200 KB Output is correct
174 Correct 665 ms 62200 KB Output is correct
175 Correct 1102 ms 64208 KB Output is correct
176 Correct 1106 ms 64144 KB Output is correct
177 Correct 1061 ms 64144 KB Output is correct
178 Correct 1128 ms 64040 KB Output is correct
179 Correct 1483 ms 66828 KB Output is correct
180 Correct 637 ms 67012 KB Output is correct
181 Correct 1459 ms 67032 KB Output is correct
182 Correct 1490 ms 67032 KB Output is correct
183 Correct 1471 ms 67024 KB Output is correct
184 Correct 1261 ms 67024 KB Output is correct
185 Correct 2311 ms 67032 KB Output is correct
186 Correct 2347 ms 67024 KB Output is correct
187 Correct 2257 ms 67012 KB Output is correct
188 Correct 2270 ms 67168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 58004 KB Output is correct
2 Correct 442 ms 62140 KB Output is correct
3 Correct 137 ms 62160 KB Output is correct
4 Correct 450 ms 62076 KB Output is correct
5 Correct 470 ms 62148 KB Output is correct
6 Correct 467 ms 55760 KB Output is correct
7 Correct 52 ms 58056 KB Output is correct
8 Correct 77 ms 60624 KB Output is correct
9 Correct 292 ms 55732 KB Output is correct
10 Correct 323 ms 55728 KB Output is correct
11 Correct 110 ms 58060 KB Output is correct
12 Correct 421 ms 63040 KB Output is correct
13 Correct 134 ms 62160 KB Output is correct
14 Correct 423 ms 62200 KB Output is correct
15 Correct 431 ms 62400 KB Output is correct
16 Correct 452 ms 62204 KB Output is correct
17 Correct 48 ms 62148 KB Output is correct
18 Correct 67 ms 62156 KB Output is correct
19 Correct 258 ms 62148 KB Output is correct
20 Correct 311 ms 62204 KB Output is correct
21 Correct 43 ms 63924 KB Output is correct
22 Correct 68 ms 64204 KB Output is correct
23 Correct 700 ms 64144 KB Output is correct
24 Correct 314 ms 64044 KB Output is correct
25 Correct 721 ms 63944 KB Output is correct
26 Correct 710 ms 64152 KB Output is correct
27 Correct 736 ms 63944 KB Output is correct
28 Correct 542 ms 64144 KB Output is correct
29 Correct 109 ms 58304 KB Output is correct
30 Correct 417 ms 62112 KB Output is correct
31 Correct 132 ms 62152 KB Output is correct
32 Correct 417 ms 62400 KB Output is correct
33 Correct 417 ms 62160 KB Output is correct
34 Correct 432 ms 62148 KB Output is correct
35 Correct 44 ms 62152 KB Output is correct
36 Correct 67 ms 62300 KB Output is correct
37 Correct 262 ms 62156 KB Output is correct
38 Correct 304 ms 62200 KB Output is correct
39 Correct 42 ms 64200 KB Output is correct
40 Correct 73 ms 64104 KB Output is correct
41 Correct 709 ms 64144 KB Output is correct
42 Correct 315 ms 64188 KB Output is correct
43 Correct 696 ms 63940 KB Output is correct
44 Correct 701 ms 64188 KB Output is correct
45 Correct 711 ms 64148 KB Output is correct
46 Correct 529 ms 63936 KB Output is correct
47 Correct 45 ms 67792 KB Output is correct
48 Correct 74 ms 67012 KB Output is correct
49 Correct 1428 ms 67272 KB Output is correct
50 Correct 678 ms 67168 KB Output is correct
51 Correct 1484 ms 67024 KB Output is correct
52 Correct 1488 ms 67032 KB Output is correct
53 Correct 1479 ms 67032 KB Output is correct
54 Correct 1249 ms 67024 KB Output is correct
55 Correct 111 ms 58060 KB Output is correct
56 Correct 416 ms 62928 KB Output is correct
57 Correct 132 ms 62080 KB Output is correct
58 Correct 433 ms 63064 KB Output is correct
59 Correct 420 ms 62204 KB Output is correct
60 Correct 436 ms 63040 KB Output is correct
61 Correct 44 ms 62152 KB Output is correct
62 Correct 76 ms 62156 KB Output is correct
63 Correct 267 ms 62208 KB Output is correct
64 Correct 306 ms 62160 KB Output is correct
65 Correct 43 ms 63952 KB Output is correct
66 Correct 69 ms 63944 KB Output is correct
67 Correct 718 ms 63952 KB Output is correct
68 Correct 329 ms 64204 KB Output is correct
69 Correct 729 ms 64144 KB Output is correct
70 Correct 740 ms 61548 KB Output is correct
71 Correct 748 ms 57544 KB Output is correct
72 Correct 582 ms 57484 KB Output is correct
73 Correct 58 ms 66780 KB Output is correct
74 Correct 75 ms 67024 KB Output is correct
75 Correct 1452 ms 67028 KB Output is correct
76 Correct 641 ms 67780 KB Output is correct
77 Correct 1458 ms 67028 KB Output is correct
78 Correct 1482 ms 67008 KB Output is correct
79 Correct 1430 ms 67028 KB Output is correct
80 Correct 1231 ms 67020 KB Output is correct
81 Correct 4361 ms 71616 KB Output is correct
82 Correct 1947 ms 71824 KB Output is correct
83 Correct 4382 ms 71832 KB Output is correct
84 Correct 4715 ms 71616 KB Output is correct
85 Correct 50 ms 71632 KB Output is correct
86 Correct 74 ms 71620 KB Output is correct
87 Correct 4195 ms 71988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 53968 KB Output is correct
2 Correct 46 ms 55244 KB Output is correct
3 Correct 20 ms 50128 KB Output is correct
4 Correct 105 ms 58180 KB Output is correct
5 Correct 5 ms 37720 KB Output is correct
6 Correct 972 ms 63952 KB Output is correct
7 Correct 425 ms 63952 KB Output is correct
8 Correct 968 ms 64144 KB Output is correct
9 Correct 983 ms 64148 KB Output is correct
10 Correct 44 ms 63952 KB Output is correct
11 Correct 81 ms 63948 KB Output is correct
12 Correct 48 ms 53968 KB Output is correct
13 Correct 40 ms 55248 KB Output is correct
14 Correct 20 ms 50124 KB Output is correct
15 Correct 106 ms 58060 KB Output is correct
16 Correct 7 ms 37720 KB Output is correct
17 Correct 952 ms 63940 KB Output is correct
18 Correct 429 ms 63952 KB Output is correct
19 Correct 957 ms 64140 KB Output is correct
20 Correct 984 ms 64408 KB Output is correct
21 Correct 42 ms 63948 KB Output is correct
22 Correct 66 ms 64120 KB Output is correct
23 Correct 5 ms 37720 KB Output is correct
24 Correct 2069 ms 67028 KB Output is correct
25 Correct 862 ms 67012 KB Output is correct
26 Correct 2124 ms 67028 KB Output is correct
27 Correct 2200 ms 67008 KB Output is correct
28 Correct 50 ms 66776 KB Output is correct
29 Correct 80 ms 66892 KB Output is correct
30 Correct 112 ms 58004 KB Output is correct
31 Correct 442 ms 62140 KB Output is correct
32 Correct 137 ms 62160 KB Output is correct
33 Correct 450 ms 62076 KB Output is correct
34 Correct 470 ms 62148 KB Output is correct
35 Correct 467 ms 55760 KB Output is correct
36 Correct 52 ms 58056 KB Output is correct
37 Correct 77 ms 60624 KB Output is correct
38 Correct 292 ms 55732 KB Output is correct
39 Correct 323 ms 55728 KB Output is correct
40 Correct 52 ms 53964 KB Output is correct
41 Correct 53 ms 55236 KB Output is correct
42 Correct 21 ms 50128 KB Output is correct
43 Correct 108 ms 58064 KB Output is correct
44 Correct 444 ms 62152 KB Output is correct
45 Correct 132 ms 62156 KB Output is correct
46 Correct 427 ms 62200 KB Output is correct
47 Correct 446 ms 62204 KB Output is correct
48 Correct 453 ms 62160 KB Output is correct
49 Correct 44 ms 62152 KB Output is correct
50 Correct 69 ms 62148 KB Output is correct
51 Correct 277 ms 62200 KB Output is correct
52 Correct 301 ms 62924 KB Output is correct
53 Correct 651 ms 62152 KB Output is correct
54 Correct 254 ms 62160 KB Output is correct
55 Correct 653 ms 62208 KB Output is correct
56 Correct 632 ms 62200 KB Output is correct
57 Correct 654 ms 63088 KB Output is correct
58 Correct 110 ms 58060 KB Output is correct
59 Correct 421 ms 63040 KB Output is correct
60 Correct 134 ms 62160 KB Output is correct
61 Correct 423 ms 62200 KB Output is correct
62 Correct 431 ms 62400 KB Output is correct
63 Correct 452 ms 62204 KB Output is correct
64 Correct 48 ms 62148 KB Output is correct
65 Correct 67 ms 62156 KB Output is correct
66 Correct 258 ms 62148 KB Output is correct
67 Correct 311 ms 62204 KB Output is correct
68 Correct 43 ms 63924 KB Output is correct
69 Correct 68 ms 64204 KB Output is correct
70 Correct 700 ms 64144 KB Output is correct
71 Correct 314 ms 64044 KB Output is correct
72 Correct 721 ms 63944 KB Output is correct
73 Correct 710 ms 64152 KB Output is correct
74 Correct 736 ms 63944 KB Output is correct
75 Correct 542 ms 64144 KB Output is correct
76 Correct 50 ms 53968 KB Output is correct
77 Correct 44 ms 55244 KB Output is correct
78 Correct 22 ms 50124 KB Output is correct
79 Correct 110 ms 58052 KB Output is correct
80 Correct 5 ms 37728 KB Output is correct
81 Correct 990 ms 64144 KB Output is correct
82 Correct 432 ms 63944 KB Output is correct
83 Correct 947 ms 63952 KB Output is correct
84 Correct 1010 ms 63944 KB Output is correct
85 Correct 42 ms 63984 KB Output is correct
86 Correct 74 ms 63948 KB Output is correct
87 Correct 418 ms 62200 KB Output is correct
88 Correct 131 ms 62148 KB Output is correct
89 Correct 423 ms 62208 KB Output is correct
90 Correct 437 ms 62404 KB Output is correct
91 Correct 439 ms 62224 KB Output is correct
92 Correct 45 ms 62156 KB Output is correct
93 Correct 69 ms 62208 KB Output is correct
94 Correct 285 ms 62152 KB Output is correct
95 Correct 304 ms 62148 KB Output is correct
96 Correct 650 ms 62204 KB Output is correct
97 Correct 253 ms 62148 KB Output is correct
98 Correct 648 ms 62200 KB Output is correct
99 Correct 634 ms 62360 KB Output is correct
100 Correct 642 ms 62204 KB Output is correct
101 Correct 707 ms 64144 KB Output is correct
102 Correct 309 ms 64144 KB Output is correct
103 Correct 687 ms 63932 KB Output is correct
104 Correct 693 ms 63952 KB Output is correct
105 Correct 714 ms 64144 KB Output is correct
106 Correct 537 ms 64148 KB Output is correct
107 Correct 1090 ms 64980 KB Output is correct
108 Correct 1100 ms 63932 KB Output is correct
109 Correct 1055 ms 64144 KB Output is correct
110 Correct 1088 ms 64980 KB Output is correct
111 Correct 109 ms 58304 KB Output is correct
112 Correct 417 ms 62112 KB Output is correct
113 Correct 132 ms 62152 KB Output is correct
114 Correct 417 ms 62400 KB Output is correct
115 Correct 417 ms 62160 KB Output is correct
116 Correct 432 ms 62148 KB Output is correct
117 Correct 44 ms 62152 KB Output is correct
118 Correct 67 ms 62300 KB Output is correct
119 Correct 262 ms 62156 KB Output is correct
120 Correct 304 ms 62200 KB Output is correct
121 Correct 42 ms 64200 KB Output is correct
122 Correct 73 ms 64104 KB Output is correct
123 Correct 709 ms 64144 KB Output is correct
124 Correct 315 ms 64188 KB Output is correct
125 Correct 696 ms 63940 KB Output is correct
126 Correct 701 ms 64188 KB Output is correct
127 Correct 711 ms 64148 KB Output is correct
128 Correct 529 ms 63936 KB Output is correct
129 Correct 45 ms 67792 KB Output is correct
130 Correct 74 ms 67012 KB Output is correct
131 Correct 1428 ms 67272 KB Output is correct
132 Correct 678 ms 67168 KB Output is correct
133 Correct 1484 ms 67024 KB Output is correct
134 Correct 1488 ms 67032 KB Output is correct
135 Correct 1479 ms 67032 KB Output is correct
136 Correct 1249 ms 67024 KB Output is correct
137 Correct 49 ms 53968 KB Output is correct
138 Correct 39 ms 55244 KB Output is correct
139 Correct 20 ms 50128 KB Output is correct
140 Correct 113 ms 57952 KB Output is correct
141 Correct 5 ms 37720 KB Output is correct
142 Correct 966 ms 64140 KB Output is correct
143 Correct 474 ms 64976 KB Output is correct
144 Correct 959 ms 64144 KB Output is correct
145 Correct 979 ms 64200 KB Output is correct
146 Correct 44 ms 63944 KB Output is correct
147 Correct 69 ms 64164 KB Output is correct
148 Correct 6 ms 37724 KB Output is correct
149 Correct 2039 ms 67028 KB Output is correct
150 Correct 834 ms 67012 KB Output is correct
151 Correct 2089 ms 67028 KB Output is correct
152 Correct 2090 ms 67028 KB Output is correct
153 Correct 49 ms 66772 KB Output is correct
154 Correct 80 ms 67012 KB Output is correct
155 Correct 425 ms 62148 KB Output is correct
156 Correct 134 ms 62404 KB Output is correct
157 Correct 437 ms 62152 KB Output is correct
158 Correct 429 ms 62208 KB Output is correct
159 Correct 439 ms 62148 KB Output is correct
160 Correct 54 ms 61988 KB Output is correct
161 Correct 72 ms 62152 KB Output is correct
162 Correct 267 ms 62152 KB Output is correct
163 Correct 309 ms 62156 KB Output is correct
164 Correct 708 ms 64052 KB Output is correct
165 Correct 349 ms 64192 KB Output is correct
166 Correct 710 ms 63940 KB Output is correct
167 Correct 724 ms 64140 KB Output is correct
168 Correct 732 ms 64016 KB Output is correct
169 Correct 562 ms 63948 KB Output is correct
170 Correct 641 ms 62144 KB Output is correct
171 Correct 275 ms 62152 KB Output is correct
172 Correct 670 ms 62204 KB Output is correct
173 Correct 651 ms 62200 KB Output is correct
174 Correct 665 ms 62200 KB Output is correct
175 Correct 1102 ms 64208 KB Output is correct
176 Correct 1106 ms 64144 KB Output is correct
177 Correct 1061 ms 64144 KB Output is correct
178 Correct 1128 ms 64040 KB Output is correct
179 Correct 1483 ms 66828 KB Output is correct
180 Correct 637 ms 67012 KB Output is correct
181 Correct 1459 ms 67032 KB Output is correct
182 Correct 1490 ms 67032 KB Output is correct
183 Correct 1471 ms 67024 KB Output is correct
184 Correct 1261 ms 67024 KB Output is correct
185 Correct 2311 ms 67032 KB Output is correct
186 Correct 2347 ms 67024 KB Output is correct
187 Correct 2257 ms 67012 KB Output is correct
188 Correct 2270 ms 67168 KB Output is correct
189 Correct 111 ms 58060 KB Output is correct
190 Correct 416 ms 62928 KB Output is correct
191 Correct 132 ms 62080 KB Output is correct
192 Correct 433 ms 63064 KB Output is correct
193 Correct 420 ms 62204 KB Output is correct
194 Correct 436 ms 63040 KB Output is correct
195 Correct 44 ms 62152 KB Output is correct
196 Correct 76 ms 62156 KB Output is correct
197 Correct 267 ms 62208 KB Output is correct
198 Correct 306 ms 62160 KB Output is correct
199 Correct 43 ms 63952 KB Output is correct
200 Correct 69 ms 63944 KB Output is correct
201 Correct 718 ms 63952 KB Output is correct
202 Correct 329 ms 64204 KB Output is correct
203 Correct 729 ms 64144 KB Output is correct
204 Correct 740 ms 61548 KB Output is correct
205 Correct 748 ms 57544 KB Output is correct
206 Correct 582 ms 57484 KB Output is correct
207 Correct 58 ms 66780 KB Output is correct
208 Correct 75 ms 67024 KB Output is correct
209 Correct 1452 ms 67028 KB Output is correct
210 Correct 641 ms 67780 KB Output is correct
211 Correct 1458 ms 67028 KB Output is correct
212 Correct 1482 ms 67008 KB Output is correct
213 Correct 1430 ms 67028 KB Output is correct
214 Correct 1231 ms 67020 KB Output is correct
215 Correct 4361 ms 71616 KB Output is correct
216 Correct 1947 ms 71824 KB Output is correct
217 Correct 4382 ms 71832 KB Output is correct
218 Correct 4715 ms 71616 KB Output is correct
219 Correct 50 ms 71632 KB Output is correct
220 Correct 74 ms 71620 KB Output is correct
221 Correct 4195 ms 71988 KB Output is correct
222 Correct 112 ms 58060 KB Output is correct
223 Correct 402 ms 62160 KB Output is correct
224 Correct 130 ms 62152 KB Output is correct
225 Correct 409 ms 62148 KB Output is correct
226 Correct 412 ms 62228 KB Output is correct
227 Correct 429 ms 62152 KB Output is correct
228 Correct 45 ms 62160 KB Output is correct
229 Correct 70 ms 62148 KB Output is correct
230 Correct 263 ms 62160 KB Output is correct
231 Correct 298 ms 61984 KB Output is correct
232 Correct 45 ms 63944 KB Output is correct
233 Correct 66 ms 64220 KB Output is correct
234 Correct 686 ms 63952 KB Output is correct
235 Correct 312 ms 63952 KB Output is correct
236 Correct 707 ms 64152 KB Output is correct
237 Correct 685 ms 63952 KB Output is correct
238 Correct 706 ms 63936 KB Output is correct
239 Correct 560 ms 63940 KB Output is correct
240 Correct 49 ms 67020 KB Output is correct
241 Correct 77 ms 67020 KB Output is correct
242 Correct 1434 ms 67016 KB Output is correct
243 Correct 617 ms 67028 KB Output is correct
244 Correct 1453 ms 67012 KB Output is correct
245 Correct 1481 ms 66872 KB Output is correct
246 Correct 1404 ms 67024 KB Output is correct
247 Correct 1221 ms 67024 KB Output is correct
248 Correct 48 ms 53968 KB Output is correct
249 Correct 40 ms 55244 KB Output is correct
250 Correct 20 ms 50124 KB Output is correct
251 Correct 5 ms 37868 KB Output is correct
252 Correct 949 ms 63948 KB Output is correct
253 Correct 435 ms 64148 KB Output is correct
254 Correct 948 ms 64140 KB Output is correct
255 Correct 956 ms 63952 KB Output is correct
256 Correct 5 ms 37720 KB Output is correct
257 Correct 2028 ms 67024 KB Output is correct
258 Correct 832 ms 67016 KB Output is correct
259 Correct 2080 ms 67028 KB Output is correct
260 Correct 2159 ms 67032 KB Output is correct
261 Correct 674 ms 62220 KB Output is correct
262 Correct 257 ms 62160 KB Output is correct
263 Correct 683 ms 62204 KB Output is correct
264 Correct 655 ms 62396 KB Output is correct
265 Correct 670 ms 62144 KB Output is correct
266 Correct 1114 ms 63940 KB Output is correct
267 Correct 1119 ms 64224 KB Output is correct
268 Correct 1058 ms 64148 KB Output is correct
269 Correct 1113 ms 64168 KB Output is correct
270 Correct 2277 ms 67964 KB Output is correct
271 Correct 2387 ms 67028 KB Output is correct
272 Correct 2291 ms 67032 KB Output is correct
273 Correct 2325 ms 67020 KB Output is correct
274 Correct 4490 ms 71900 KB Output is correct
275 Correct 2000 ms 71612 KB Output is correct
276 Correct 4352 ms 71616 KB Output is correct
277 Correct 4377 ms 71648 KB Output is correct
278 Correct 62 ms 71616 KB Output is correct
279 Correct 76 ms 71716 KB Output is correct
280 Correct 3831 ms 71824 KB Output is correct
281 Execution timed out 5064 ms 71804 KB Time limit exceeded
282 Halted 0 ms 0 KB -