Submission #1070947

# Submission time Handle Problem Language Result Execution time Memory
1070947 2024-08-22T21:37:46 Z AdamGS Uplifting Excursion (BOI22_vault) C++17
90 / 100
5000 ms 37956 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;
ll dp[LIM], dp2[LIM], A[LIM], B[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;
	}
	rep(xd, 2) {
		for(ll i=1; i<=n; ++i) if(A[i]) {
			vector<ll>V[i], l(i);
			rep(j, LIM) {
				ll p=j%i;
				while(l[p]<V[p].size() && (j-V[p][l[p]])/i>A[i]) ++l[p];
				while(V[p].size()>0 && dp[j]<=dp[V[p].back()]+(j-V[p].back())/i) {
					V[p].pop_back();
					l[p]=min(l[p], (ll)V[p].size());
				}
				dp2[j]=dp[j];
				if(l[p]<V[p].size()) {
					dp2[j]=min(dp2[j], dp[V[p][l[p]]]+(j-V[p][l[p]])/i);
				}
				V[p].pb(j);
			}
			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';
}

Compilation message

vault.cpp: In function 'int main()':
vault.cpp:50:15: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |     while(l[p]<V[p].size() && (j-V[p][l[p]])/i>A[i]) ++l[p];
vault.cpp:56:12: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |     if(l[p]<V[p].size()) {
# Verdict Execution time Memory Grader output
1 Correct 40 ms 19036 KB Output is correct
2 Correct 29 ms 19036 KB Output is correct
3 Correct 13 ms 19036 KB Output is correct
4 Correct 92 ms 19036 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 941 ms 19500 KB Output is correct
7 Correct 415 ms 19280 KB Output is correct
8 Correct 938 ms 19508 KB Output is correct
9 Correct 945 ms 19568 KB Output is correct
10 Correct 22 ms 19036 KB Output is correct
11 Correct 48 ms 19036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 19036 KB Output is correct
2 Correct 29 ms 19036 KB Output is correct
3 Correct 13 ms 19036 KB Output is correct
4 Correct 92 ms 19036 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 941 ms 19500 KB Output is correct
7 Correct 415 ms 19280 KB Output is correct
8 Correct 938 ms 19508 KB Output is correct
9 Correct 945 ms 19568 KB Output is correct
10 Correct 22 ms 19036 KB Output is correct
11 Correct 48 ms 19036 KB Output is correct
12 Correct 40 ms 19260 KB Output is correct
13 Correct 29 ms 19036 KB Output is correct
14 Correct 12 ms 19036 KB Output is correct
15 Correct 89 ms 19276 KB Output is correct
16 Correct 2 ms 10840 KB Output is correct
17 Correct 925 ms 19500 KB Output is correct
18 Correct 401 ms 19404 KB Output is correct
19 Correct 926 ms 19496 KB Output is correct
20 Correct 946 ms 19728 KB Output is correct
21 Correct 24 ms 19280 KB Output is correct
22 Correct 46 ms 19032 KB Output is correct
23 Correct 2 ms 10844 KB Output is correct
24 Correct 1922 ms 20864 KB Output is correct
25 Correct 763 ms 19708 KB Output is correct
26 Correct 2009 ms 22212 KB Output is correct
27 Correct 1972 ms 22084 KB Output is correct
28 Correct 23 ms 19036 KB Output is correct
29 Correct 46 ms 19036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 19032 KB Output is correct
2 Correct 405 ms 23128 KB Output is correct
3 Correct 117 ms 26048 KB Output is correct
4 Correct 447 ms 31796 KB Output is correct
5 Correct 419 ms 31496 KB Output is correct
6 Correct 523 ms 34088 KB Output is correct
7 Correct 23 ms 19544 KB Output is correct
8 Correct 49 ms 19036 KB Output is correct
9 Correct 292 ms 35364 KB Output is correct
10 Correct 292 ms 26256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 19032 KB Output is correct
2 Correct 405 ms 23128 KB Output is correct
3 Correct 117 ms 26048 KB Output is correct
4 Correct 447 ms 31796 KB Output is correct
5 Correct 419 ms 31496 KB Output is correct
6 Correct 523 ms 34088 KB Output is correct
7 Correct 23 ms 19544 KB Output is correct
8 Correct 49 ms 19036 KB Output is correct
9 Correct 292 ms 35364 KB Output is correct
10 Correct 292 ms 26256 KB Output is correct
11 Correct 39 ms 19252 KB Output is correct
12 Correct 30 ms 19032 KB Output is correct
13 Correct 13 ms 19036 KB Output is correct
14 Correct 88 ms 19036 KB Output is correct
15 Correct 396 ms 23164 KB Output is correct
16 Correct 114 ms 26240 KB Output is correct
17 Correct 457 ms 31936 KB Output is correct
18 Correct 424 ms 31656 KB Output is correct
19 Correct 509 ms 32756 KB Output is correct
20 Correct 25 ms 19544 KB Output is correct
21 Correct 49 ms 19036 KB Output is correct
22 Correct 288 ms 33832 KB Output is correct
23 Correct 292 ms 26300 KB Output is correct
24 Correct 622 ms 25324 KB Output is correct
25 Correct 233 ms 25348 KB Output is correct
26 Correct 723 ms 32320 KB Output is correct
27 Correct 647 ms 31376 KB Output is correct
28 Correct 760 ms 35028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 19032 KB Output is correct
2 Correct 405 ms 23128 KB Output is correct
3 Correct 117 ms 26048 KB Output is correct
4 Correct 447 ms 31796 KB Output is correct
5 Correct 419 ms 31496 KB Output is correct
6 Correct 523 ms 34088 KB Output is correct
7 Correct 23 ms 19544 KB Output is correct
8 Correct 49 ms 19036 KB Output is correct
9 Correct 292 ms 35364 KB Output is correct
10 Correct 292 ms 26256 KB Output is correct
11 Correct 91 ms 19260 KB Output is correct
12 Correct 405 ms 23160 KB Output is correct
13 Correct 116 ms 26248 KB Output is correct
14 Correct 457 ms 31804 KB Output is correct
15 Correct 426 ms 31504 KB Output is correct
16 Correct 531 ms 35372 KB Output is correct
17 Correct 24 ms 19548 KB Output is correct
18 Correct 50 ms 19036 KB Output is correct
19 Correct 283 ms 35624 KB Output is correct
20 Correct 291 ms 26176 KB Output is correct
21 Correct 21 ms 19036 KB Output is correct
22 Correct 48 ms 19032 KB Output is correct
23 Correct 705 ms 28852 KB Output is correct
24 Correct 302 ms 31712 KB Output is correct
25 Correct 749 ms 32504 KB Output is correct
26 Correct 755 ms 32068 KB Output is correct
27 Correct 883 ms 35428 KB Output is correct
28 Correct 527 ms 25236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 19036 KB Output is correct
2 Correct 29 ms 19036 KB Output is correct
3 Correct 13 ms 19036 KB Output is correct
4 Correct 92 ms 19036 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 941 ms 19500 KB Output is correct
7 Correct 415 ms 19280 KB Output is correct
8 Correct 938 ms 19508 KB Output is correct
9 Correct 945 ms 19568 KB Output is correct
10 Correct 22 ms 19036 KB Output is correct
11 Correct 48 ms 19036 KB Output is correct
12 Correct 90 ms 19032 KB Output is correct
13 Correct 405 ms 23128 KB Output is correct
14 Correct 117 ms 26048 KB Output is correct
15 Correct 447 ms 31796 KB Output is correct
16 Correct 419 ms 31496 KB Output is correct
17 Correct 523 ms 34088 KB Output is correct
18 Correct 23 ms 19544 KB Output is correct
19 Correct 49 ms 19036 KB Output is correct
20 Correct 292 ms 35364 KB Output is correct
21 Correct 292 ms 26256 KB Output is correct
22 Correct 39 ms 19252 KB Output is correct
23 Correct 30 ms 19032 KB Output is correct
24 Correct 13 ms 19036 KB Output is correct
25 Correct 88 ms 19036 KB Output is correct
26 Correct 396 ms 23164 KB Output is correct
27 Correct 114 ms 26240 KB Output is correct
28 Correct 457 ms 31936 KB Output is correct
29 Correct 424 ms 31656 KB Output is correct
30 Correct 509 ms 32756 KB Output is correct
31 Correct 25 ms 19544 KB Output is correct
32 Correct 49 ms 19036 KB Output is correct
33 Correct 288 ms 33832 KB Output is correct
34 Correct 292 ms 26300 KB Output is correct
35 Correct 622 ms 25324 KB Output is correct
36 Correct 233 ms 25348 KB Output is correct
37 Correct 723 ms 32320 KB Output is correct
38 Correct 647 ms 31376 KB Output is correct
39 Correct 760 ms 35028 KB Output is correct
40 Correct 91 ms 19260 KB Output is correct
41 Correct 405 ms 23160 KB Output is correct
42 Correct 116 ms 26248 KB Output is correct
43 Correct 457 ms 31804 KB Output is correct
44 Correct 426 ms 31504 KB Output is correct
45 Correct 531 ms 35372 KB Output is correct
46 Correct 24 ms 19548 KB Output is correct
47 Correct 50 ms 19036 KB Output is correct
48 Correct 283 ms 35624 KB Output is correct
49 Correct 291 ms 26176 KB Output is correct
50 Correct 21 ms 19036 KB Output is correct
51 Correct 48 ms 19032 KB Output is correct
52 Correct 705 ms 28852 KB Output is correct
53 Correct 302 ms 31712 KB Output is correct
54 Correct 749 ms 32504 KB Output is correct
55 Correct 755 ms 32068 KB Output is correct
56 Correct 883 ms 35428 KB Output is correct
57 Correct 527 ms 25236 KB Output is correct
58 Correct 41 ms 19036 KB Output is correct
59 Correct 31 ms 19276 KB Output is correct
60 Correct 14 ms 19036 KB Output is correct
61 Correct 97 ms 19036 KB Output is correct
62 Correct 2 ms 10840 KB Output is correct
63 Correct 924 ms 19464 KB Output is correct
64 Correct 405 ms 19284 KB Output is correct
65 Correct 930 ms 19508 KB Output is correct
66 Correct 939 ms 19588 KB Output is correct
67 Correct 22 ms 19036 KB Output is correct
68 Correct 48 ms 19036 KB Output is correct
69 Correct 408 ms 23144 KB Output is correct
70 Correct 120 ms 26248 KB Output is correct
71 Correct 467 ms 31836 KB Output is correct
72 Correct 433 ms 31492 KB Output is correct
73 Correct 533 ms 35620 KB Output is correct
74 Correct 26 ms 19544 KB Output is correct
75 Correct 50 ms 19032 KB Output is correct
76 Correct 292 ms 32956 KB Output is correct
77 Correct 296 ms 26224 KB Output is correct
78 Correct 637 ms 25372 KB Output is correct
79 Correct 240 ms 25340 KB Output is correct
80 Correct 731 ms 32160 KB Output is correct
81 Correct 655 ms 31376 KB Output is correct
82 Correct 760 ms 33300 KB Output is correct
83 Correct 694 ms 28920 KB Output is correct
84 Correct 311 ms 31708 KB Output is correct
85 Correct 740 ms 35616 KB Output is correct
86 Correct 760 ms 31808 KB Output is correct
87 Correct 882 ms 35624 KB Output is correct
88 Correct 536 ms 25016 KB Output is correct
89 Correct 1074 ms 25956 KB Output is correct
90 Correct 1119 ms 29052 KB Output is correct
91 Correct 1079 ms 35096 KB Output is correct
92 Correct 1257 ms 35020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 19032 KB Output is correct
2 Correct 405 ms 23128 KB Output is correct
3 Correct 117 ms 26048 KB Output is correct
4 Correct 447 ms 31796 KB Output is correct
5 Correct 419 ms 31496 KB Output is correct
6 Correct 523 ms 34088 KB Output is correct
7 Correct 23 ms 19544 KB Output is correct
8 Correct 49 ms 19036 KB Output is correct
9 Correct 292 ms 35364 KB Output is correct
10 Correct 292 ms 26256 KB Output is correct
11 Correct 91 ms 19260 KB Output is correct
12 Correct 405 ms 23160 KB Output is correct
13 Correct 116 ms 26248 KB Output is correct
14 Correct 457 ms 31804 KB Output is correct
15 Correct 426 ms 31504 KB Output is correct
16 Correct 531 ms 35372 KB Output is correct
17 Correct 24 ms 19548 KB Output is correct
18 Correct 50 ms 19036 KB Output is correct
19 Correct 283 ms 35624 KB Output is correct
20 Correct 291 ms 26176 KB Output is correct
21 Correct 21 ms 19036 KB Output is correct
22 Correct 48 ms 19032 KB Output is correct
23 Correct 705 ms 28852 KB Output is correct
24 Correct 302 ms 31712 KB Output is correct
25 Correct 749 ms 32504 KB Output is correct
26 Correct 755 ms 32068 KB Output is correct
27 Correct 883 ms 35428 KB Output is correct
28 Correct 527 ms 25236 KB Output is correct
29 Correct 90 ms 19036 KB Output is correct
30 Correct 415 ms 23128 KB Output is correct
31 Correct 116 ms 26236 KB Output is correct
32 Correct 453 ms 31832 KB Output is correct
33 Correct 423 ms 31672 KB Output is correct
34 Correct 552 ms 34800 KB Output is correct
35 Correct 24 ms 19544 KB Output is correct
36 Correct 51 ms 19036 KB Output is correct
37 Correct 289 ms 32672 KB Output is correct
38 Correct 296 ms 26252 KB Output is correct
39 Correct 21 ms 19036 KB Output is correct
40 Correct 47 ms 19032 KB Output is correct
41 Correct 697 ms 28876 KB Output is correct
42 Correct 299 ms 31700 KB Output is correct
43 Correct 718 ms 35464 KB Output is correct
44 Correct 731 ms 31992 KB Output is correct
45 Correct 876 ms 33060 KB Output is correct
46 Correct 522 ms 25040 KB Output is correct
47 Correct 22 ms 19036 KB Output is correct
48 Correct 44 ms 19280 KB Output is correct
49 Correct 1420 ms 34960 KB Output is correct
50 Correct 594 ms 23624 KB Output is correct
51 Correct 1439 ms 33824 KB Output is correct
52 Correct 1515 ms 31052 KB Output is correct
53 Correct 1749 ms 35620 KB Output is correct
54 Correct 1250 ms 26324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 19036 KB Output is correct
2 Correct 29 ms 19036 KB Output is correct
3 Correct 13 ms 19036 KB Output is correct
4 Correct 92 ms 19036 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 941 ms 19500 KB Output is correct
7 Correct 415 ms 19280 KB Output is correct
8 Correct 938 ms 19508 KB Output is correct
9 Correct 945 ms 19568 KB Output is correct
10 Correct 22 ms 19036 KB Output is correct
11 Correct 48 ms 19036 KB Output is correct
12 Correct 40 ms 19260 KB Output is correct
13 Correct 29 ms 19036 KB Output is correct
14 Correct 12 ms 19036 KB Output is correct
15 Correct 89 ms 19276 KB Output is correct
16 Correct 2 ms 10840 KB Output is correct
17 Correct 925 ms 19500 KB Output is correct
18 Correct 401 ms 19404 KB Output is correct
19 Correct 926 ms 19496 KB Output is correct
20 Correct 946 ms 19728 KB Output is correct
21 Correct 24 ms 19280 KB Output is correct
22 Correct 46 ms 19032 KB Output is correct
23 Correct 2 ms 10844 KB Output is correct
24 Correct 1922 ms 20864 KB Output is correct
25 Correct 763 ms 19708 KB Output is correct
26 Correct 2009 ms 22212 KB Output is correct
27 Correct 1972 ms 22084 KB Output is correct
28 Correct 23 ms 19036 KB Output is correct
29 Correct 46 ms 19036 KB Output is correct
30 Correct 90 ms 19032 KB Output is correct
31 Correct 405 ms 23128 KB Output is correct
32 Correct 117 ms 26048 KB Output is correct
33 Correct 447 ms 31796 KB Output is correct
34 Correct 419 ms 31496 KB Output is correct
35 Correct 523 ms 34088 KB Output is correct
36 Correct 23 ms 19544 KB Output is correct
37 Correct 49 ms 19036 KB Output is correct
38 Correct 292 ms 35364 KB Output is correct
39 Correct 292 ms 26256 KB Output is correct
40 Correct 39 ms 19252 KB Output is correct
41 Correct 30 ms 19032 KB Output is correct
42 Correct 13 ms 19036 KB Output is correct
43 Correct 88 ms 19036 KB Output is correct
44 Correct 396 ms 23164 KB Output is correct
45 Correct 114 ms 26240 KB Output is correct
46 Correct 457 ms 31936 KB Output is correct
47 Correct 424 ms 31656 KB Output is correct
48 Correct 509 ms 32756 KB Output is correct
49 Correct 25 ms 19544 KB Output is correct
50 Correct 49 ms 19036 KB Output is correct
51 Correct 288 ms 33832 KB Output is correct
52 Correct 292 ms 26300 KB Output is correct
53 Correct 622 ms 25324 KB Output is correct
54 Correct 233 ms 25348 KB Output is correct
55 Correct 723 ms 32320 KB Output is correct
56 Correct 647 ms 31376 KB Output is correct
57 Correct 760 ms 35028 KB Output is correct
58 Correct 91 ms 19260 KB Output is correct
59 Correct 405 ms 23160 KB Output is correct
60 Correct 116 ms 26248 KB Output is correct
61 Correct 457 ms 31804 KB Output is correct
62 Correct 426 ms 31504 KB Output is correct
63 Correct 531 ms 35372 KB Output is correct
64 Correct 24 ms 19548 KB Output is correct
65 Correct 50 ms 19036 KB Output is correct
66 Correct 283 ms 35624 KB Output is correct
67 Correct 291 ms 26176 KB Output is correct
68 Correct 21 ms 19036 KB Output is correct
69 Correct 48 ms 19032 KB Output is correct
70 Correct 705 ms 28852 KB Output is correct
71 Correct 302 ms 31712 KB Output is correct
72 Correct 749 ms 32504 KB Output is correct
73 Correct 755 ms 32068 KB Output is correct
74 Correct 883 ms 35428 KB Output is correct
75 Correct 527 ms 25236 KB Output is correct
76 Correct 41 ms 19036 KB Output is correct
77 Correct 31 ms 19276 KB Output is correct
78 Correct 14 ms 19036 KB Output is correct
79 Correct 97 ms 19036 KB Output is correct
80 Correct 2 ms 10840 KB Output is correct
81 Correct 924 ms 19464 KB Output is correct
82 Correct 405 ms 19284 KB Output is correct
83 Correct 930 ms 19508 KB Output is correct
84 Correct 939 ms 19588 KB Output is correct
85 Correct 22 ms 19036 KB Output is correct
86 Correct 48 ms 19036 KB Output is correct
87 Correct 408 ms 23144 KB Output is correct
88 Correct 120 ms 26248 KB Output is correct
89 Correct 467 ms 31836 KB Output is correct
90 Correct 433 ms 31492 KB Output is correct
91 Correct 533 ms 35620 KB Output is correct
92 Correct 26 ms 19544 KB Output is correct
93 Correct 50 ms 19032 KB Output is correct
94 Correct 292 ms 32956 KB Output is correct
95 Correct 296 ms 26224 KB Output is correct
96 Correct 637 ms 25372 KB Output is correct
97 Correct 240 ms 25340 KB Output is correct
98 Correct 731 ms 32160 KB Output is correct
99 Correct 655 ms 31376 KB Output is correct
100 Correct 760 ms 33300 KB Output is correct
101 Correct 694 ms 28920 KB Output is correct
102 Correct 311 ms 31708 KB Output is correct
103 Correct 740 ms 35616 KB Output is correct
104 Correct 760 ms 31808 KB Output is correct
105 Correct 882 ms 35624 KB Output is correct
106 Correct 536 ms 25016 KB Output is correct
107 Correct 1074 ms 25956 KB Output is correct
108 Correct 1119 ms 29052 KB Output is correct
109 Correct 1079 ms 35096 KB Output is correct
110 Correct 1257 ms 35020 KB Output is correct
111 Correct 90 ms 19036 KB Output is correct
112 Correct 415 ms 23128 KB Output is correct
113 Correct 116 ms 26236 KB Output is correct
114 Correct 453 ms 31832 KB Output is correct
115 Correct 423 ms 31672 KB Output is correct
116 Correct 552 ms 34800 KB Output is correct
117 Correct 24 ms 19544 KB Output is correct
118 Correct 51 ms 19036 KB Output is correct
119 Correct 289 ms 32672 KB Output is correct
120 Correct 296 ms 26252 KB Output is correct
121 Correct 21 ms 19036 KB Output is correct
122 Correct 47 ms 19032 KB Output is correct
123 Correct 697 ms 28876 KB Output is correct
124 Correct 299 ms 31700 KB Output is correct
125 Correct 718 ms 35464 KB Output is correct
126 Correct 731 ms 31992 KB Output is correct
127 Correct 876 ms 33060 KB Output is correct
128 Correct 522 ms 25040 KB Output is correct
129 Correct 22 ms 19036 KB Output is correct
130 Correct 44 ms 19280 KB Output is correct
131 Correct 1420 ms 34960 KB Output is correct
132 Correct 594 ms 23624 KB Output is correct
133 Correct 1439 ms 33824 KB Output is correct
134 Correct 1515 ms 31052 KB Output is correct
135 Correct 1749 ms 35620 KB Output is correct
136 Correct 1250 ms 26324 KB Output is correct
137 Correct 40 ms 19260 KB Output is correct
138 Correct 31 ms 19036 KB Output is correct
139 Correct 14 ms 19036 KB Output is correct
140 Correct 90 ms 19044 KB Output is correct
141 Correct 2 ms 10840 KB Output is correct
142 Correct 944 ms 19508 KB Output is correct
143 Correct 422 ms 19300 KB Output is correct
144 Correct 933 ms 19480 KB Output is correct
145 Correct 956 ms 19712 KB Output is correct
146 Correct 23 ms 19164 KB Output is correct
147 Correct 49 ms 19036 KB Output is correct
148 Correct 2 ms 10844 KB Output is correct
149 Correct 2037 ms 20820 KB Output is correct
150 Correct 804 ms 19688 KB Output is correct
151 Correct 2033 ms 22300 KB Output is correct
152 Correct 2056 ms 22096 KB Output is correct
153 Correct 22 ms 19036 KB Output is correct
154 Correct 45 ms 19036 KB Output is correct
155 Correct 426 ms 23164 KB Output is correct
156 Correct 118 ms 26164 KB Output is correct
157 Correct 459 ms 31848 KB Output is correct
158 Correct 433 ms 31496 KB Output is correct
159 Correct 549 ms 33044 KB Output is correct
160 Correct 27 ms 19544 KB Output is correct
161 Correct 48 ms 19036 KB Output is correct
162 Correct 290 ms 34972 KB Output is correct
163 Correct 304 ms 26244 KB Output is correct
164 Correct 718 ms 28876 KB Output is correct
165 Correct 304 ms 31712 KB Output is correct
166 Correct 728 ms 33064 KB Output is correct
167 Correct 766 ms 31812 KB Output is correct
168 Correct 866 ms 34256 KB Output is correct
169 Correct 535 ms 24996 KB Output is correct
170 Correct 636 ms 25160 KB Output is correct
171 Correct 241 ms 25328 KB Output is correct
172 Correct 742 ms 32336 KB Output is correct
173 Correct 655 ms 31272 KB Output is correct
174 Correct 757 ms 35232 KB Output is correct
175 Correct 1052 ms 25932 KB Output is correct
176 Correct 1067 ms 29052 KB Output is correct
177 Correct 1057 ms 32552 KB Output is correct
178 Correct 1223 ms 35308 KB Output is correct
179 Correct 1370 ms 32552 KB Output is correct
180 Correct 580 ms 23656 KB Output is correct
181 Correct 1415 ms 34040 KB Output is correct
182 Correct 1489 ms 31076 KB Output is correct
183 Correct 1692 ms 33548 KB Output is correct
184 Correct 1165 ms 26300 KB Output is correct
185 Correct 2101 ms 32052 KB Output is correct
186 Correct 2169 ms 31072 KB Output is correct
187 Correct 2390 ms 32112 KB Output is correct
188 Correct 2468 ms 34316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 19032 KB Output is correct
2 Correct 405 ms 23128 KB Output is correct
3 Correct 117 ms 26048 KB Output is correct
4 Correct 447 ms 31796 KB Output is correct
5 Correct 419 ms 31496 KB Output is correct
6 Correct 523 ms 34088 KB Output is correct
7 Correct 23 ms 19544 KB Output is correct
8 Correct 49 ms 19036 KB Output is correct
9 Correct 292 ms 35364 KB Output is correct
10 Correct 292 ms 26256 KB Output is correct
11 Correct 91 ms 19260 KB Output is correct
12 Correct 405 ms 23160 KB Output is correct
13 Correct 116 ms 26248 KB Output is correct
14 Correct 457 ms 31804 KB Output is correct
15 Correct 426 ms 31504 KB Output is correct
16 Correct 531 ms 35372 KB Output is correct
17 Correct 24 ms 19548 KB Output is correct
18 Correct 50 ms 19036 KB Output is correct
19 Correct 283 ms 35624 KB Output is correct
20 Correct 291 ms 26176 KB Output is correct
21 Correct 21 ms 19036 KB Output is correct
22 Correct 48 ms 19032 KB Output is correct
23 Correct 705 ms 28852 KB Output is correct
24 Correct 302 ms 31712 KB Output is correct
25 Correct 749 ms 32504 KB Output is correct
26 Correct 755 ms 32068 KB Output is correct
27 Correct 883 ms 35428 KB Output is correct
28 Correct 527 ms 25236 KB Output is correct
29 Correct 90 ms 19036 KB Output is correct
30 Correct 415 ms 23128 KB Output is correct
31 Correct 116 ms 26236 KB Output is correct
32 Correct 453 ms 31832 KB Output is correct
33 Correct 423 ms 31672 KB Output is correct
34 Correct 552 ms 34800 KB Output is correct
35 Correct 24 ms 19544 KB Output is correct
36 Correct 51 ms 19036 KB Output is correct
37 Correct 289 ms 32672 KB Output is correct
38 Correct 296 ms 26252 KB Output is correct
39 Correct 21 ms 19036 KB Output is correct
40 Correct 47 ms 19032 KB Output is correct
41 Correct 697 ms 28876 KB Output is correct
42 Correct 299 ms 31700 KB Output is correct
43 Correct 718 ms 35464 KB Output is correct
44 Correct 731 ms 31992 KB Output is correct
45 Correct 876 ms 33060 KB Output is correct
46 Correct 522 ms 25040 KB Output is correct
47 Correct 22 ms 19036 KB Output is correct
48 Correct 44 ms 19280 KB Output is correct
49 Correct 1420 ms 34960 KB Output is correct
50 Correct 594 ms 23624 KB Output is correct
51 Correct 1439 ms 33824 KB Output is correct
52 Correct 1515 ms 31052 KB Output is correct
53 Correct 1749 ms 35620 KB Output is correct
54 Correct 1250 ms 26324 KB Output is correct
55 Correct 91 ms 19032 KB Output is correct
56 Correct 408 ms 23136 KB Output is correct
57 Correct 118 ms 26224 KB Output is correct
58 Correct 446 ms 31808 KB Output is correct
59 Correct 425 ms 31724 KB Output is correct
60 Correct 519 ms 33320 KB Output is correct
61 Correct 25 ms 19548 KB Output is correct
62 Correct 49 ms 19272 KB Output is correct
63 Correct 288 ms 35096 KB Output is correct
64 Correct 291 ms 26252 KB Output is correct
65 Correct 21 ms 19036 KB Output is correct
66 Correct 47 ms 19280 KB Output is correct
67 Correct 682 ms 28868 KB Output is correct
68 Correct 305 ms 31700 KB Output is correct
69 Correct 730 ms 35356 KB Output is correct
70 Correct 731 ms 31804 KB Output is correct
71 Correct 864 ms 32548 KB Output is correct
72 Correct 521 ms 25016 KB Output is correct
73 Correct 23 ms 19032 KB Output is correct
74 Correct 47 ms 19256 KB Output is correct
75 Correct 1368 ms 35872 KB Output is correct
76 Correct 571 ms 23664 KB Output is correct
77 Correct 1387 ms 34088 KB Output is correct
78 Correct 1464 ms 31160 KB Output is correct
79 Correct 1690 ms 32548 KB Output is correct
80 Correct 1174 ms 26448 KB Output is correct
81 Correct 4125 ms 29988 KB Output is correct
82 Correct 1871 ms 23068 KB Output is correct
83 Correct 4106 ms 37956 KB Output is correct
84 Correct 4329 ms 32820 KB Output is correct
85 Correct 23 ms 19288 KB Output is correct
86 Correct 48 ms 19292 KB Output is correct
87 Correct 3610 ms 28924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 19036 KB Output is correct
2 Correct 29 ms 19036 KB Output is correct
3 Correct 13 ms 19036 KB Output is correct
4 Correct 92 ms 19036 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 941 ms 19500 KB Output is correct
7 Correct 415 ms 19280 KB Output is correct
8 Correct 938 ms 19508 KB Output is correct
9 Correct 945 ms 19568 KB Output is correct
10 Correct 22 ms 19036 KB Output is correct
11 Correct 48 ms 19036 KB Output is correct
12 Correct 40 ms 19260 KB Output is correct
13 Correct 29 ms 19036 KB Output is correct
14 Correct 12 ms 19036 KB Output is correct
15 Correct 89 ms 19276 KB Output is correct
16 Correct 2 ms 10840 KB Output is correct
17 Correct 925 ms 19500 KB Output is correct
18 Correct 401 ms 19404 KB Output is correct
19 Correct 926 ms 19496 KB Output is correct
20 Correct 946 ms 19728 KB Output is correct
21 Correct 24 ms 19280 KB Output is correct
22 Correct 46 ms 19032 KB Output is correct
23 Correct 2 ms 10844 KB Output is correct
24 Correct 1922 ms 20864 KB Output is correct
25 Correct 763 ms 19708 KB Output is correct
26 Correct 2009 ms 22212 KB Output is correct
27 Correct 1972 ms 22084 KB Output is correct
28 Correct 23 ms 19036 KB Output is correct
29 Correct 46 ms 19036 KB Output is correct
30 Correct 90 ms 19032 KB Output is correct
31 Correct 405 ms 23128 KB Output is correct
32 Correct 117 ms 26048 KB Output is correct
33 Correct 447 ms 31796 KB Output is correct
34 Correct 419 ms 31496 KB Output is correct
35 Correct 523 ms 34088 KB Output is correct
36 Correct 23 ms 19544 KB Output is correct
37 Correct 49 ms 19036 KB Output is correct
38 Correct 292 ms 35364 KB Output is correct
39 Correct 292 ms 26256 KB Output is correct
40 Correct 39 ms 19252 KB Output is correct
41 Correct 30 ms 19032 KB Output is correct
42 Correct 13 ms 19036 KB Output is correct
43 Correct 88 ms 19036 KB Output is correct
44 Correct 396 ms 23164 KB Output is correct
45 Correct 114 ms 26240 KB Output is correct
46 Correct 457 ms 31936 KB Output is correct
47 Correct 424 ms 31656 KB Output is correct
48 Correct 509 ms 32756 KB Output is correct
49 Correct 25 ms 19544 KB Output is correct
50 Correct 49 ms 19036 KB Output is correct
51 Correct 288 ms 33832 KB Output is correct
52 Correct 292 ms 26300 KB Output is correct
53 Correct 622 ms 25324 KB Output is correct
54 Correct 233 ms 25348 KB Output is correct
55 Correct 723 ms 32320 KB Output is correct
56 Correct 647 ms 31376 KB Output is correct
57 Correct 760 ms 35028 KB Output is correct
58 Correct 91 ms 19260 KB Output is correct
59 Correct 405 ms 23160 KB Output is correct
60 Correct 116 ms 26248 KB Output is correct
61 Correct 457 ms 31804 KB Output is correct
62 Correct 426 ms 31504 KB Output is correct
63 Correct 531 ms 35372 KB Output is correct
64 Correct 24 ms 19548 KB Output is correct
65 Correct 50 ms 19036 KB Output is correct
66 Correct 283 ms 35624 KB Output is correct
67 Correct 291 ms 26176 KB Output is correct
68 Correct 21 ms 19036 KB Output is correct
69 Correct 48 ms 19032 KB Output is correct
70 Correct 705 ms 28852 KB Output is correct
71 Correct 302 ms 31712 KB Output is correct
72 Correct 749 ms 32504 KB Output is correct
73 Correct 755 ms 32068 KB Output is correct
74 Correct 883 ms 35428 KB Output is correct
75 Correct 527 ms 25236 KB Output is correct
76 Correct 41 ms 19036 KB Output is correct
77 Correct 31 ms 19276 KB Output is correct
78 Correct 14 ms 19036 KB Output is correct
79 Correct 97 ms 19036 KB Output is correct
80 Correct 2 ms 10840 KB Output is correct
81 Correct 924 ms 19464 KB Output is correct
82 Correct 405 ms 19284 KB Output is correct
83 Correct 930 ms 19508 KB Output is correct
84 Correct 939 ms 19588 KB Output is correct
85 Correct 22 ms 19036 KB Output is correct
86 Correct 48 ms 19036 KB Output is correct
87 Correct 408 ms 23144 KB Output is correct
88 Correct 120 ms 26248 KB Output is correct
89 Correct 467 ms 31836 KB Output is correct
90 Correct 433 ms 31492 KB Output is correct
91 Correct 533 ms 35620 KB Output is correct
92 Correct 26 ms 19544 KB Output is correct
93 Correct 50 ms 19032 KB Output is correct
94 Correct 292 ms 32956 KB Output is correct
95 Correct 296 ms 26224 KB Output is correct
96 Correct 637 ms 25372 KB Output is correct
97 Correct 240 ms 25340 KB Output is correct
98 Correct 731 ms 32160 KB Output is correct
99 Correct 655 ms 31376 KB Output is correct
100 Correct 760 ms 33300 KB Output is correct
101 Correct 694 ms 28920 KB Output is correct
102 Correct 311 ms 31708 KB Output is correct
103 Correct 740 ms 35616 KB Output is correct
104 Correct 760 ms 31808 KB Output is correct
105 Correct 882 ms 35624 KB Output is correct
106 Correct 536 ms 25016 KB Output is correct
107 Correct 1074 ms 25956 KB Output is correct
108 Correct 1119 ms 29052 KB Output is correct
109 Correct 1079 ms 35096 KB Output is correct
110 Correct 1257 ms 35020 KB Output is correct
111 Correct 90 ms 19036 KB Output is correct
112 Correct 415 ms 23128 KB Output is correct
113 Correct 116 ms 26236 KB Output is correct
114 Correct 453 ms 31832 KB Output is correct
115 Correct 423 ms 31672 KB Output is correct
116 Correct 552 ms 34800 KB Output is correct
117 Correct 24 ms 19544 KB Output is correct
118 Correct 51 ms 19036 KB Output is correct
119 Correct 289 ms 32672 KB Output is correct
120 Correct 296 ms 26252 KB Output is correct
121 Correct 21 ms 19036 KB Output is correct
122 Correct 47 ms 19032 KB Output is correct
123 Correct 697 ms 28876 KB Output is correct
124 Correct 299 ms 31700 KB Output is correct
125 Correct 718 ms 35464 KB Output is correct
126 Correct 731 ms 31992 KB Output is correct
127 Correct 876 ms 33060 KB Output is correct
128 Correct 522 ms 25040 KB Output is correct
129 Correct 22 ms 19036 KB Output is correct
130 Correct 44 ms 19280 KB Output is correct
131 Correct 1420 ms 34960 KB Output is correct
132 Correct 594 ms 23624 KB Output is correct
133 Correct 1439 ms 33824 KB Output is correct
134 Correct 1515 ms 31052 KB Output is correct
135 Correct 1749 ms 35620 KB Output is correct
136 Correct 1250 ms 26324 KB Output is correct
137 Correct 40 ms 19260 KB Output is correct
138 Correct 31 ms 19036 KB Output is correct
139 Correct 14 ms 19036 KB Output is correct
140 Correct 90 ms 19044 KB Output is correct
141 Correct 2 ms 10840 KB Output is correct
142 Correct 944 ms 19508 KB Output is correct
143 Correct 422 ms 19300 KB Output is correct
144 Correct 933 ms 19480 KB Output is correct
145 Correct 956 ms 19712 KB Output is correct
146 Correct 23 ms 19164 KB Output is correct
147 Correct 49 ms 19036 KB Output is correct
148 Correct 2 ms 10844 KB Output is correct
149 Correct 2037 ms 20820 KB Output is correct
150 Correct 804 ms 19688 KB Output is correct
151 Correct 2033 ms 22300 KB Output is correct
152 Correct 2056 ms 22096 KB Output is correct
153 Correct 22 ms 19036 KB Output is correct
154 Correct 45 ms 19036 KB Output is correct
155 Correct 426 ms 23164 KB Output is correct
156 Correct 118 ms 26164 KB Output is correct
157 Correct 459 ms 31848 KB Output is correct
158 Correct 433 ms 31496 KB Output is correct
159 Correct 549 ms 33044 KB Output is correct
160 Correct 27 ms 19544 KB Output is correct
161 Correct 48 ms 19036 KB Output is correct
162 Correct 290 ms 34972 KB Output is correct
163 Correct 304 ms 26244 KB Output is correct
164 Correct 718 ms 28876 KB Output is correct
165 Correct 304 ms 31712 KB Output is correct
166 Correct 728 ms 33064 KB Output is correct
167 Correct 766 ms 31812 KB Output is correct
168 Correct 866 ms 34256 KB Output is correct
169 Correct 535 ms 24996 KB Output is correct
170 Correct 636 ms 25160 KB Output is correct
171 Correct 241 ms 25328 KB Output is correct
172 Correct 742 ms 32336 KB Output is correct
173 Correct 655 ms 31272 KB Output is correct
174 Correct 757 ms 35232 KB Output is correct
175 Correct 1052 ms 25932 KB Output is correct
176 Correct 1067 ms 29052 KB Output is correct
177 Correct 1057 ms 32552 KB Output is correct
178 Correct 1223 ms 35308 KB Output is correct
179 Correct 1370 ms 32552 KB Output is correct
180 Correct 580 ms 23656 KB Output is correct
181 Correct 1415 ms 34040 KB Output is correct
182 Correct 1489 ms 31076 KB Output is correct
183 Correct 1692 ms 33548 KB Output is correct
184 Correct 1165 ms 26300 KB Output is correct
185 Correct 2101 ms 32052 KB Output is correct
186 Correct 2169 ms 31072 KB Output is correct
187 Correct 2390 ms 32112 KB Output is correct
188 Correct 2468 ms 34316 KB Output is correct
189 Correct 91 ms 19032 KB Output is correct
190 Correct 408 ms 23136 KB Output is correct
191 Correct 118 ms 26224 KB Output is correct
192 Correct 446 ms 31808 KB Output is correct
193 Correct 425 ms 31724 KB Output is correct
194 Correct 519 ms 33320 KB Output is correct
195 Correct 25 ms 19548 KB Output is correct
196 Correct 49 ms 19272 KB Output is correct
197 Correct 288 ms 35096 KB Output is correct
198 Correct 291 ms 26252 KB Output is correct
199 Correct 21 ms 19036 KB Output is correct
200 Correct 47 ms 19280 KB Output is correct
201 Correct 682 ms 28868 KB Output is correct
202 Correct 305 ms 31700 KB Output is correct
203 Correct 730 ms 35356 KB Output is correct
204 Correct 731 ms 31804 KB Output is correct
205 Correct 864 ms 32548 KB Output is correct
206 Correct 521 ms 25016 KB Output is correct
207 Correct 23 ms 19032 KB Output is correct
208 Correct 47 ms 19256 KB Output is correct
209 Correct 1368 ms 35872 KB Output is correct
210 Correct 571 ms 23664 KB Output is correct
211 Correct 1387 ms 34088 KB Output is correct
212 Correct 1464 ms 31160 KB Output is correct
213 Correct 1690 ms 32548 KB Output is correct
214 Correct 1174 ms 26448 KB Output is correct
215 Correct 4125 ms 29988 KB Output is correct
216 Correct 1871 ms 23068 KB Output is correct
217 Correct 4106 ms 37956 KB Output is correct
218 Correct 4329 ms 32820 KB Output is correct
219 Correct 23 ms 19288 KB Output is correct
220 Correct 48 ms 19292 KB Output is correct
221 Correct 3610 ms 28924 KB Output is correct
222 Correct 92 ms 19036 KB Output is correct
223 Correct 414 ms 23164 KB Output is correct
224 Correct 113 ms 26236 KB Output is correct
225 Correct 455 ms 31736 KB Output is correct
226 Correct 422 ms 31508 KB Output is correct
227 Correct 513 ms 35104 KB Output is correct
228 Correct 24 ms 19544 KB Output is correct
229 Correct 48 ms 19036 KB Output is correct
230 Correct 278 ms 35624 KB Output is correct
231 Correct 288 ms 26200 KB Output is correct
232 Correct 23 ms 19036 KB Output is correct
233 Correct 45 ms 19032 KB Output is correct
234 Correct 676 ms 28868 KB Output is correct
235 Correct 289 ms 32008 KB Output is correct
236 Correct 724 ms 33220 KB Output is correct
237 Correct 732 ms 31960 KB Output is correct
238 Correct 827 ms 32552 KB Output is correct
239 Correct 528 ms 25208 KB Output is correct
240 Correct 22 ms 19032 KB Output is correct
241 Correct 46 ms 19036 KB Output is correct
242 Correct 1365 ms 34344 KB Output is correct
243 Correct 572 ms 23520 KB Output is correct
244 Correct 1387 ms 35104 KB Output is correct
245 Correct 1468 ms 31080 KB Output is correct
246 Correct 1735 ms 33060 KB Output is correct
247 Correct 1183 ms 26540 KB Output is correct
248 Correct 39 ms 19036 KB Output is correct
249 Correct 32 ms 19036 KB Output is correct
250 Correct 13 ms 19276 KB Output is correct
251 Correct 2 ms 10844 KB Output is correct
252 Correct 933 ms 19508 KB Output is correct
253 Correct 407 ms 19272 KB Output is correct
254 Correct 929 ms 19508 KB Output is correct
255 Correct 960 ms 19592 KB Output is correct
256 Correct 2 ms 10844 KB Output is correct
257 Correct 1972 ms 20988 KB Output is correct
258 Correct 777 ms 19736 KB Output is correct
259 Correct 2019 ms 22288 KB Output is correct
260 Correct 2017 ms 22188 KB Output is correct
261 Correct 627 ms 25284 KB Output is correct
262 Correct 248 ms 25360 KB Output is correct
263 Correct 755 ms 32376 KB Output is correct
264 Correct 667 ms 31380 KB Output is correct
265 Correct 762 ms 35580 KB Output is correct
266 Correct 1065 ms 25924 KB Output is correct
267 Correct 1088 ms 29048 KB Output is correct
268 Correct 1059 ms 34584 KB Output is correct
269 Correct 1232 ms 34776 KB Output is correct
270 Correct 2132 ms 31972 KB Output is correct
271 Correct 2237 ms 31076 KB Output is correct
272 Correct 2472 ms 32028 KB Output is correct
273 Correct 2481 ms 32552 KB Output is correct
274 Correct 4160 ms 30032 KB Output is correct
275 Correct 1966 ms 23076 KB Output is correct
276 Correct 4225 ms 33332 KB Output is correct
277 Correct 4458 ms 32544 KB Output is correct
278 Correct 23 ms 19292 KB Output is correct
279 Correct 46 ms 19036 KB Output is correct
280 Correct 3746 ms 28948 KB Output is correct
281 Execution timed out 5044 ms 27232 KB Time limit exceeded
282 Halted 0 ms 0 KB -