Submission #1070871

# Submission time Handle Problem Language Result Execution time Memory
1070871 2024-08-22T20:15:40 Z AdamGS Uplifting Excursion (BOI22_vault) C++17
80 / 100
5000 ms 35712 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;
	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]-100, 0ll));
			A[i]-=p;
			dp[0]+=p;
			m-=p*i;	
		}
	}
	if(m>=LIM) {
		cout << "impossible\n";
		return 0;
	}
	rep(xd, 2) {
		for(ll i=1; i<=n; ++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:48: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]
   48 |     while(l[p]<V[p].size() && (j-V[p][l[p]])/i>A[i]) ++l[p];
vault.cpp:54: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]
   54 |     if(l[p]<V[p].size()) {
# Verdict Execution time Memory Grader output
1 Correct 39 ms 19032 KB Output is correct
2 Correct 57 ms 19268 KB Output is correct
3 Correct 21 ms 19036 KB Output is correct
4 Correct 200 ms 19036 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 971 ms 19456 KB Output is correct
7 Correct 954 ms 19400 KB Output is correct
8 Correct 966 ms 19648 KB Output is correct
9 Correct 951 ms 19592 KB Output is correct
10 Correct 847 ms 19036 KB Output is correct
11 Correct 857 ms 19264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 19032 KB Output is correct
2 Correct 57 ms 19268 KB Output is correct
3 Correct 21 ms 19036 KB Output is correct
4 Correct 200 ms 19036 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 971 ms 19456 KB Output is correct
7 Correct 954 ms 19400 KB Output is correct
8 Correct 966 ms 19648 KB Output is correct
9 Correct 951 ms 19592 KB Output is correct
10 Correct 847 ms 19036 KB Output is correct
11 Correct 857 ms 19264 KB Output is correct
12 Correct 39 ms 19032 KB Output is correct
13 Correct 65 ms 19036 KB Output is correct
14 Correct 22 ms 19036 KB Output is correct
15 Correct 187 ms 19264 KB Output is correct
16 Correct 2 ms 10844 KB Output is correct
17 Correct 969 ms 19508 KB Output is correct
18 Correct 977 ms 19528 KB Output is correct
19 Correct 993 ms 19668 KB Output is correct
20 Correct 981 ms 19592 KB Output is correct
21 Correct 867 ms 19256 KB Output is correct
22 Correct 872 ms 19256 KB Output is correct
23 Correct 2 ms 10844 KB Output is correct
24 Correct 2078 ms 20936 KB Output is correct
25 Correct 1974 ms 19744 KB Output is correct
26 Correct 2096 ms 22244 KB Output is correct
27 Correct 2057 ms 22172 KB Output is correct
28 Correct 1644 ms 19284 KB Output is correct
29 Correct 1612 ms 19276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 195 ms 19508 KB Output is correct
2 Correct 637 ms 23128 KB Output is correct
3 Correct 583 ms 26168 KB Output is correct
4 Correct 681 ms 31740 KB Output is correct
5 Correct 660 ms 31488 KB Output is correct
6 Correct 762 ms 35624 KB Output is correct
7 Correct 503 ms 19644 KB Output is correct
8 Correct 520 ms 19512 KB Output is correct
9 Correct 678 ms 35320 KB Output is correct
10 Correct 646 ms 26260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 195 ms 19508 KB Output is correct
2 Correct 637 ms 23128 KB Output is correct
3 Correct 583 ms 26168 KB Output is correct
4 Correct 681 ms 31740 KB Output is correct
5 Correct 660 ms 31488 KB Output is correct
6 Correct 762 ms 35624 KB Output is correct
7 Correct 503 ms 19644 KB Output is correct
8 Correct 520 ms 19512 KB Output is correct
9 Correct 678 ms 35320 KB Output is correct
10 Correct 646 ms 26260 KB Output is correct
11 Correct 41 ms 19036 KB Output is correct
12 Correct 58 ms 19276 KB Output is correct
13 Correct 22 ms 19036 KB Output is correct
14 Correct 194 ms 19276 KB Output is correct
15 Correct 670 ms 23156 KB Output is correct
16 Correct 570 ms 26168 KB Output is correct
17 Correct 707 ms 31660 KB Output is correct
18 Correct 690 ms 31508 KB Output is correct
19 Correct 789 ms 35312 KB Output is correct
20 Correct 507 ms 19652 KB Output is correct
21 Correct 521 ms 19524 KB Output is correct
22 Correct 687 ms 34076 KB Output is correct
23 Correct 637 ms 26368 KB Output is correct
24 Correct 646 ms 25216 KB Output is correct
25 Correct 568 ms 25628 KB Output is correct
26 Correct 763 ms 31828 KB Output is correct
27 Correct 671 ms 31548 KB Output is correct
28 Correct 765 ms 32532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 195 ms 19508 KB Output is correct
2 Correct 637 ms 23128 KB Output is correct
3 Correct 583 ms 26168 KB Output is correct
4 Correct 681 ms 31740 KB Output is correct
5 Correct 660 ms 31488 KB Output is correct
6 Correct 762 ms 35624 KB Output is correct
7 Correct 503 ms 19644 KB Output is correct
8 Correct 520 ms 19512 KB Output is correct
9 Correct 678 ms 35320 KB Output is correct
10 Correct 646 ms 26260 KB Output is correct
11 Correct 194 ms 19036 KB Output is correct
12 Correct 644 ms 23148 KB Output is correct
13 Correct 565 ms 26140 KB Output is correct
14 Correct 696 ms 31740 KB Output is correct
15 Correct 686 ms 31504 KB Output is correct
16 Correct 796 ms 35712 KB Output is correct
17 Correct 516 ms 19700 KB Output is correct
18 Correct 513 ms 19528 KB Output is correct
19 Correct 660 ms 35360 KB Output is correct
20 Correct 634 ms 26292 KB Output is correct
21 Correct 825 ms 19036 KB Output is correct
22 Correct 815 ms 19036 KB Output is correct
23 Correct 1098 ms 28904 KB Output is correct
24 Correct 1008 ms 31616 KB Output is correct
25 Correct 1158 ms 33652 KB Output is correct
26 Correct 1134 ms 31812 KB Output is correct
27 Correct 1282 ms 33024 KB Output is correct
28 Correct 1124 ms 25240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 19032 KB Output is correct
2 Correct 57 ms 19268 KB Output is correct
3 Correct 21 ms 19036 KB Output is correct
4 Correct 200 ms 19036 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 971 ms 19456 KB Output is correct
7 Correct 954 ms 19400 KB Output is correct
8 Correct 966 ms 19648 KB Output is correct
9 Correct 951 ms 19592 KB Output is correct
10 Correct 847 ms 19036 KB Output is correct
11 Correct 857 ms 19264 KB Output is correct
12 Correct 195 ms 19508 KB Output is correct
13 Correct 637 ms 23128 KB Output is correct
14 Correct 583 ms 26168 KB Output is correct
15 Correct 681 ms 31740 KB Output is correct
16 Correct 660 ms 31488 KB Output is correct
17 Correct 762 ms 35624 KB Output is correct
18 Correct 503 ms 19644 KB Output is correct
19 Correct 520 ms 19512 KB Output is correct
20 Correct 678 ms 35320 KB Output is correct
21 Correct 646 ms 26260 KB Output is correct
22 Correct 41 ms 19036 KB Output is correct
23 Correct 58 ms 19276 KB Output is correct
24 Correct 22 ms 19036 KB Output is correct
25 Correct 194 ms 19276 KB Output is correct
26 Correct 670 ms 23156 KB Output is correct
27 Correct 570 ms 26168 KB Output is correct
28 Correct 707 ms 31660 KB Output is correct
29 Correct 690 ms 31508 KB Output is correct
30 Correct 789 ms 35312 KB Output is correct
31 Correct 507 ms 19652 KB Output is correct
32 Correct 521 ms 19524 KB Output is correct
33 Correct 687 ms 34076 KB Output is correct
34 Correct 637 ms 26368 KB Output is correct
35 Correct 646 ms 25216 KB Output is correct
36 Correct 568 ms 25628 KB Output is correct
37 Correct 763 ms 31828 KB Output is correct
38 Correct 671 ms 31548 KB Output is correct
39 Correct 765 ms 32532 KB Output is correct
40 Correct 194 ms 19036 KB Output is correct
41 Correct 644 ms 23148 KB Output is correct
42 Correct 565 ms 26140 KB Output is correct
43 Correct 696 ms 31740 KB Output is correct
44 Correct 686 ms 31504 KB Output is correct
45 Correct 796 ms 35712 KB Output is correct
46 Correct 516 ms 19700 KB Output is correct
47 Correct 513 ms 19528 KB Output is correct
48 Correct 660 ms 35360 KB Output is correct
49 Correct 634 ms 26292 KB Output is correct
50 Correct 825 ms 19036 KB Output is correct
51 Correct 815 ms 19036 KB Output is correct
52 Correct 1098 ms 28904 KB Output is correct
53 Correct 1008 ms 31616 KB Output is correct
54 Correct 1158 ms 33652 KB Output is correct
55 Correct 1134 ms 31812 KB Output is correct
56 Correct 1282 ms 33024 KB Output is correct
57 Correct 1124 ms 25240 KB Output is correct
58 Correct 47 ms 19252 KB Output is correct
59 Correct 55 ms 19036 KB Output is correct
60 Correct 21 ms 19036 KB Output is correct
61 Correct 199 ms 19256 KB Output is correct
62 Correct 2 ms 10844 KB Output is correct
63 Correct 945 ms 19500 KB Output is correct
64 Correct 926 ms 19288 KB Output is correct
65 Correct 953 ms 19760 KB Output is correct
66 Correct 941 ms 19852 KB Output is correct
67 Correct 809 ms 19036 KB Output is correct
68 Correct 813 ms 19036 KB Output is correct
69 Correct 635 ms 23168 KB Output is correct
70 Correct 584 ms 26424 KB Output is correct
71 Correct 684 ms 31940 KB Output is correct
72 Correct 692 ms 31476 KB Output is correct
73 Correct 762 ms 32608 KB Output is correct
74 Correct 497 ms 19680 KB Output is correct
75 Correct 500 ms 19540 KB Output is correct
76 Correct 657 ms 35104 KB Output is correct
77 Correct 615 ms 26272 KB Output is correct
78 Correct 646 ms 25296 KB Output is correct
79 Correct 572 ms 25640 KB Output is correct
80 Correct 779 ms 31840 KB Output is correct
81 Correct 683 ms 31560 KB Output is correct
82 Correct 784 ms 33676 KB Output is correct
83 Correct 1144 ms 28888 KB Output is correct
84 Correct 1040 ms 31576 KB Output is correct
85 Correct 1136 ms 33064 KB Output is correct
86 Correct 1133 ms 31808 KB Output is correct
87 Correct 1266 ms 32544 KB Output is correct
88 Correct 1076 ms 25052 KB Output is correct
89 Correct 1089 ms 25964 KB Output is correct
90 Correct 1101 ms 29044 KB Output is correct
91 Correct 1142 ms 32552 KB Output is correct
92 Correct 1348 ms 35168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 195 ms 19508 KB Output is correct
2 Correct 637 ms 23128 KB Output is correct
3 Correct 583 ms 26168 KB Output is correct
4 Correct 681 ms 31740 KB Output is correct
5 Correct 660 ms 31488 KB Output is correct
6 Correct 762 ms 35624 KB Output is correct
7 Correct 503 ms 19644 KB Output is correct
8 Correct 520 ms 19512 KB Output is correct
9 Correct 678 ms 35320 KB Output is correct
10 Correct 646 ms 26260 KB Output is correct
11 Correct 194 ms 19036 KB Output is correct
12 Correct 644 ms 23148 KB Output is correct
13 Correct 565 ms 26140 KB Output is correct
14 Correct 696 ms 31740 KB Output is correct
15 Correct 686 ms 31504 KB Output is correct
16 Correct 796 ms 35712 KB Output is correct
17 Correct 516 ms 19700 KB Output is correct
18 Correct 513 ms 19528 KB Output is correct
19 Correct 660 ms 35360 KB Output is correct
20 Correct 634 ms 26292 KB Output is correct
21 Correct 825 ms 19036 KB Output is correct
22 Correct 815 ms 19036 KB Output is correct
23 Correct 1098 ms 28904 KB Output is correct
24 Correct 1008 ms 31616 KB Output is correct
25 Correct 1158 ms 33652 KB Output is correct
26 Correct 1134 ms 31812 KB Output is correct
27 Correct 1282 ms 33024 KB Output is correct
28 Correct 1124 ms 25240 KB Output is correct
29 Correct 205 ms 19256 KB Output is correct
30 Correct 672 ms 23128 KB Output is correct
31 Correct 608 ms 26196 KB Output is correct
32 Correct 736 ms 31832 KB Output is correct
33 Correct 726 ms 31460 KB Output is correct
34 Correct 800 ms 32544 KB Output is correct
35 Correct 527 ms 19684 KB Output is correct
36 Correct 515 ms 19516 KB Output is correct
37 Correct 717 ms 35160 KB Output is correct
38 Correct 657 ms 26260 KB Output is correct
39 Correct 876 ms 19264 KB Output is correct
40 Correct 846 ms 19036 KB Output is correct
41 Correct 1120 ms 28872 KB Output is correct
42 Correct 1075 ms 31564 KB Output is correct
43 Correct 1174 ms 34828 KB Output is correct
44 Correct 1177 ms 31868 KB Output is correct
45 Correct 1280 ms 34088 KB Output is correct
46 Correct 1073 ms 25068 KB Output is correct
47 Correct 1621 ms 19152 KB Output is correct
48 Correct 1664 ms 19276 KB Output is correct
49 Correct 2254 ms 32552 KB Output is correct
50 Correct 2029 ms 23852 KB Output is correct
51 Correct 2235 ms 34856 KB Output is correct
52 Correct 2312 ms 31104 KB Output is correct
53 Correct 2565 ms 34860 KB Output is correct
54 Correct 2201 ms 26296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 19032 KB Output is correct
2 Correct 57 ms 19268 KB Output is correct
3 Correct 21 ms 19036 KB Output is correct
4 Correct 200 ms 19036 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 971 ms 19456 KB Output is correct
7 Correct 954 ms 19400 KB Output is correct
8 Correct 966 ms 19648 KB Output is correct
9 Correct 951 ms 19592 KB Output is correct
10 Correct 847 ms 19036 KB Output is correct
11 Correct 857 ms 19264 KB Output is correct
12 Correct 39 ms 19032 KB Output is correct
13 Correct 65 ms 19036 KB Output is correct
14 Correct 22 ms 19036 KB Output is correct
15 Correct 187 ms 19264 KB Output is correct
16 Correct 2 ms 10844 KB Output is correct
17 Correct 969 ms 19508 KB Output is correct
18 Correct 977 ms 19528 KB Output is correct
19 Correct 993 ms 19668 KB Output is correct
20 Correct 981 ms 19592 KB Output is correct
21 Correct 867 ms 19256 KB Output is correct
22 Correct 872 ms 19256 KB Output is correct
23 Correct 2 ms 10844 KB Output is correct
24 Correct 2078 ms 20936 KB Output is correct
25 Correct 1974 ms 19744 KB Output is correct
26 Correct 2096 ms 22244 KB Output is correct
27 Correct 2057 ms 22172 KB Output is correct
28 Correct 1644 ms 19284 KB Output is correct
29 Correct 1612 ms 19276 KB Output is correct
30 Correct 195 ms 19508 KB Output is correct
31 Correct 637 ms 23128 KB Output is correct
32 Correct 583 ms 26168 KB Output is correct
33 Correct 681 ms 31740 KB Output is correct
34 Correct 660 ms 31488 KB Output is correct
35 Correct 762 ms 35624 KB Output is correct
36 Correct 503 ms 19644 KB Output is correct
37 Correct 520 ms 19512 KB Output is correct
38 Correct 678 ms 35320 KB Output is correct
39 Correct 646 ms 26260 KB Output is correct
40 Correct 41 ms 19036 KB Output is correct
41 Correct 58 ms 19276 KB Output is correct
42 Correct 22 ms 19036 KB Output is correct
43 Correct 194 ms 19276 KB Output is correct
44 Correct 670 ms 23156 KB Output is correct
45 Correct 570 ms 26168 KB Output is correct
46 Correct 707 ms 31660 KB Output is correct
47 Correct 690 ms 31508 KB Output is correct
48 Correct 789 ms 35312 KB Output is correct
49 Correct 507 ms 19652 KB Output is correct
50 Correct 521 ms 19524 KB Output is correct
51 Correct 687 ms 34076 KB Output is correct
52 Correct 637 ms 26368 KB Output is correct
53 Correct 646 ms 25216 KB Output is correct
54 Correct 568 ms 25628 KB Output is correct
55 Correct 763 ms 31828 KB Output is correct
56 Correct 671 ms 31548 KB Output is correct
57 Correct 765 ms 32532 KB Output is correct
58 Correct 194 ms 19036 KB Output is correct
59 Correct 644 ms 23148 KB Output is correct
60 Correct 565 ms 26140 KB Output is correct
61 Correct 696 ms 31740 KB Output is correct
62 Correct 686 ms 31504 KB Output is correct
63 Correct 796 ms 35712 KB Output is correct
64 Correct 516 ms 19700 KB Output is correct
65 Correct 513 ms 19528 KB Output is correct
66 Correct 660 ms 35360 KB Output is correct
67 Correct 634 ms 26292 KB Output is correct
68 Correct 825 ms 19036 KB Output is correct
69 Correct 815 ms 19036 KB Output is correct
70 Correct 1098 ms 28904 KB Output is correct
71 Correct 1008 ms 31616 KB Output is correct
72 Correct 1158 ms 33652 KB Output is correct
73 Correct 1134 ms 31812 KB Output is correct
74 Correct 1282 ms 33024 KB Output is correct
75 Correct 1124 ms 25240 KB Output is correct
76 Correct 47 ms 19252 KB Output is correct
77 Correct 55 ms 19036 KB Output is correct
78 Correct 21 ms 19036 KB Output is correct
79 Correct 199 ms 19256 KB Output is correct
80 Correct 2 ms 10844 KB Output is correct
81 Correct 945 ms 19500 KB Output is correct
82 Correct 926 ms 19288 KB Output is correct
83 Correct 953 ms 19760 KB Output is correct
84 Correct 941 ms 19852 KB Output is correct
85 Correct 809 ms 19036 KB Output is correct
86 Correct 813 ms 19036 KB Output is correct
87 Correct 635 ms 23168 KB Output is correct
88 Correct 584 ms 26424 KB Output is correct
89 Correct 684 ms 31940 KB Output is correct
90 Correct 692 ms 31476 KB Output is correct
91 Correct 762 ms 32608 KB Output is correct
92 Correct 497 ms 19680 KB Output is correct
93 Correct 500 ms 19540 KB Output is correct
94 Correct 657 ms 35104 KB Output is correct
95 Correct 615 ms 26272 KB Output is correct
96 Correct 646 ms 25296 KB Output is correct
97 Correct 572 ms 25640 KB Output is correct
98 Correct 779 ms 31840 KB Output is correct
99 Correct 683 ms 31560 KB Output is correct
100 Correct 784 ms 33676 KB Output is correct
101 Correct 1144 ms 28888 KB Output is correct
102 Correct 1040 ms 31576 KB Output is correct
103 Correct 1136 ms 33064 KB Output is correct
104 Correct 1133 ms 31808 KB Output is correct
105 Correct 1266 ms 32544 KB Output is correct
106 Correct 1076 ms 25052 KB Output is correct
107 Correct 1089 ms 25964 KB Output is correct
108 Correct 1101 ms 29044 KB Output is correct
109 Correct 1142 ms 32552 KB Output is correct
110 Correct 1348 ms 35168 KB Output is correct
111 Correct 205 ms 19256 KB Output is correct
112 Correct 672 ms 23128 KB Output is correct
113 Correct 608 ms 26196 KB Output is correct
114 Correct 736 ms 31832 KB Output is correct
115 Correct 726 ms 31460 KB Output is correct
116 Correct 800 ms 32544 KB Output is correct
117 Correct 527 ms 19684 KB Output is correct
118 Correct 515 ms 19516 KB Output is correct
119 Correct 717 ms 35160 KB Output is correct
120 Correct 657 ms 26260 KB Output is correct
121 Correct 876 ms 19264 KB Output is correct
122 Correct 846 ms 19036 KB Output is correct
123 Correct 1120 ms 28872 KB Output is correct
124 Correct 1075 ms 31564 KB Output is correct
125 Correct 1174 ms 34828 KB Output is correct
126 Correct 1177 ms 31868 KB Output is correct
127 Correct 1280 ms 34088 KB Output is correct
128 Correct 1073 ms 25068 KB Output is correct
129 Correct 1621 ms 19152 KB Output is correct
130 Correct 1664 ms 19276 KB Output is correct
131 Correct 2254 ms 32552 KB Output is correct
132 Correct 2029 ms 23852 KB Output is correct
133 Correct 2235 ms 34856 KB Output is correct
134 Correct 2312 ms 31104 KB Output is correct
135 Correct 2565 ms 34860 KB Output is correct
136 Correct 2201 ms 26296 KB Output is correct
137 Correct 40 ms 19036 KB Output is correct
138 Correct 54 ms 19036 KB Output is correct
139 Correct 20 ms 19036 KB Output is correct
140 Correct 192 ms 19256 KB Output is correct
141 Correct 2 ms 10844 KB Output is correct
142 Correct 973 ms 19508 KB Output is correct
143 Correct 919 ms 19284 KB Output is correct
144 Correct 940 ms 19480 KB Output is correct
145 Correct 940 ms 19700 KB Output is correct
146 Correct 813 ms 19036 KB Output is correct
147 Correct 824 ms 19284 KB Output is correct
148 Correct 2 ms 10844 KB Output is correct
149 Correct 1975 ms 20900 KB Output is correct
150 Correct 1972 ms 19824 KB Output is correct
151 Correct 2047 ms 22228 KB Output is correct
152 Correct 2008 ms 22088 KB Output is correct
153 Correct 1627 ms 19256 KB Output is correct
154 Correct 1627 ms 19284 KB Output is correct
155 Correct 672 ms 23128 KB Output is correct
156 Correct 610 ms 26172 KB Output is correct
157 Correct 757 ms 31680 KB Output is correct
158 Correct 720 ms 31520 KB Output is correct
159 Correct 811 ms 32520 KB Output is correct
160 Correct 519 ms 19656 KB Output is correct
161 Correct 530 ms 19540 KB Output is correct
162 Correct 669 ms 33200 KB Output is correct
163 Correct 631 ms 26264 KB Output is correct
164 Correct 1105 ms 28872 KB Output is correct
165 Correct 1035 ms 31600 KB Output is correct
166 Correct 1177 ms 34684 KB Output is correct
167 Correct 1165 ms 31960 KB Output is correct
168 Correct 1274 ms 34392 KB Output is correct
169 Correct 1045 ms 25096 KB Output is correct
170 Correct 660 ms 25212 KB Output is correct
171 Correct 563 ms 25668 KB Output is correct
172 Correct 718 ms 31868 KB Output is correct
173 Correct 652 ms 31564 KB Output is correct
174 Correct 752 ms 34920 KB Output is correct
175 Correct 1065 ms 25924 KB Output is correct
176 Correct 1077 ms 28852 KB Output is correct
177 Correct 1077 ms 34336 KB Output is correct
178 Correct 1242 ms 33480 KB Output is correct
179 Correct 2223 ms 33832 KB Output is correct
180 Correct 2041 ms 23720 KB Output is correct
181 Correct 2249 ms 35356 KB Output is correct
182 Correct 2323 ms 31080 KB Output is correct
183 Correct 2607 ms 33756 KB Output is correct
184 Correct 2219 ms 26296 KB Output is correct
185 Correct 2249 ms 33468 KB Output is correct
186 Correct 2288 ms 31072 KB Output is correct
187 Correct 2616 ms 31556 KB Output is correct
188 Correct 2663 ms 33304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 195 ms 19508 KB Output is correct
2 Correct 637 ms 23128 KB Output is correct
3 Correct 583 ms 26168 KB Output is correct
4 Correct 681 ms 31740 KB Output is correct
5 Correct 660 ms 31488 KB Output is correct
6 Correct 762 ms 35624 KB Output is correct
7 Correct 503 ms 19644 KB Output is correct
8 Correct 520 ms 19512 KB Output is correct
9 Correct 678 ms 35320 KB Output is correct
10 Correct 646 ms 26260 KB Output is correct
11 Correct 194 ms 19036 KB Output is correct
12 Correct 644 ms 23148 KB Output is correct
13 Correct 565 ms 26140 KB Output is correct
14 Correct 696 ms 31740 KB Output is correct
15 Correct 686 ms 31504 KB Output is correct
16 Correct 796 ms 35712 KB Output is correct
17 Correct 516 ms 19700 KB Output is correct
18 Correct 513 ms 19528 KB Output is correct
19 Correct 660 ms 35360 KB Output is correct
20 Correct 634 ms 26292 KB Output is correct
21 Correct 825 ms 19036 KB Output is correct
22 Correct 815 ms 19036 KB Output is correct
23 Correct 1098 ms 28904 KB Output is correct
24 Correct 1008 ms 31616 KB Output is correct
25 Correct 1158 ms 33652 KB Output is correct
26 Correct 1134 ms 31812 KB Output is correct
27 Correct 1282 ms 33024 KB Output is correct
28 Correct 1124 ms 25240 KB Output is correct
29 Correct 205 ms 19256 KB Output is correct
30 Correct 672 ms 23128 KB Output is correct
31 Correct 608 ms 26196 KB Output is correct
32 Correct 736 ms 31832 KB Output is correct
33 Correct 726 ms 31460 KB Output is correct
34 Correct 800 ms 32544 KB Output is correct
35 Correct 527 ms 19684 KB Output is correct
36 Correct 515 ms 19516 KB Output is correct
37 Correct 717 ms 35160 KB Output is correct
38 Correct 657 ms 26260 KB Output is correct
39 Correct 876 ms 19264 KB Output is correct
40 Correct 846 ms 19036 KB Output is correct
41 Correct 1120 ms 28872 KB Output is correct
42 Correct 1075 ms 31564 KB Output is correct
43 Correct 1174 ms 34828 KB Output is correct
44 Correct 1177 ms 31868 KB Output is correct
45 Correct 1280 ms 34088 KB Output is correct
46 Correct 1073 ms 25068 KB Output is correct
47 Correct 1621 ms 19152 KB Output is correct
48 Correct 1664 ms 19276 KB Output is correct
49 Correct 2254 ms 32552 KB Output is correct
50 Correct 2029 ms 23852 KB Output is correct
51 Correct 2235 ms 34856 KB Output is correct
52 Correct 2312 ms 31104 KB Output is correct
53 Correct 2565 ms 34860 KB Output is correct
54 Correct 2201 ms 26296 KB Output is correct
55 Correct 198 ms 19264 KB Output is correct
56 Correct 697 ms 23140 KB Output is correct
57 Correct 615 ms 26168 KB Output is correct
58 Correct 745 ms 31636 KB Output is correct
59 Correct 697 ms 31512 KB Output is correct
60 Correct 822 ms 32548 KB Output is correct
61 Correct 523 ms 19656 KB Output is correct
62 Correct 547 ms 19512 KB Output is correct
63 Correct 744 ms 35348 KB Output is correct
64 Correct 683 ms 26228 KB Output is correct
65 Correct 865 ms 19036 KB Output is correct
66 Correct 877 ms 19036 KB Output is correct
67 Correct 1157 ms 28908 KB Output is correct
68 Correct 1061 ms 31500 KB Output is correct
69 Correct 1226 ms 32996 KB Output is correct
70 Correct 1224 ms 33504 KB Output is correct
71 Correct 1343 ms 33316 KB Output is correct
72 Correct 1094 ms 25256 KB Output is correct
73 Correct 1633 ms 19288 KB Output is correct
74 Correct 1603 ms 19288 KB Output is correct
75 Correct 2211 ms 33108 KB Output is correct
76 Correct 2031 ms 23720 KB Output is correct
77 Correct 2241 ms 35628 KB Output is correct
78 Correct 2339 ms 31052 KB Output is correct
79 Correct 2552 ms 34056 KB Output is correct
80 Correct 2162 ms 26296 KB Output is correct
81 Execution timed out 5042 ms 30228 KB Time limit exceeded
82 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 19032 KB Output is correct
2 Correct 57 ms 19268 KB Output is correct
3 Correct 21 ms 19036 KB Output is correct
4 Correct 200 ms 19036 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 971 ms 19456 KB Output is correct
7 Correct 954 ms 19400 KB Output is correct
8 Correct 966 ms 19648 KB Output is correct
9 Correct 951 ms 19592 KB Output is correct
10 Correct 847 ms 19036 KB Output is correct
11 Correct 857 ms 19264 KB Output is correct
12 Correct 39 ms 19032 KB Output is correct
13 Correct 65 ms 19036 KB Output is correct
14 Correct 22 ms 19036 KB Output is correct
15 Correct 187 ms 19264 KB Output is correct
16 Correct 2 ms 10844 KB Output is correct
17 Correct 969 ms 19508 KB Output is correct
18 Correct 977 ms 19528 KB Output is correct
19 Correct 993 ms 19668 KB Output is correct
20 Correct 981 ms 19592 KB Output is correct
21 Correct 867 ms 19256 KB Output is correct
22 Correct 872 ms 19256 KB Output is correct
23 Correct 2 ms 10844 KB Output is correct
24 Correct 2078 ms 20936 KB Output is correct
25 Correct 1974 ms 19744 KB Output is correct
26 Correct 2096 ms 22244 KB Output is correct
27 Correct 2057 ms 22172 KB Output is correct
28 Correct 1644 ms 19284 KB Output is correct
29 Correct 1612 ms 19276 KB Output is correct
30 Correct 195 ms 19508 KB Output is correct
31 Correct 637 ms 23128 KB Output is correct
32 Correct 583 ms 26168 KB Output is correct
33 Correct 681 ms 31740 KB Output is correct
34 Correct 660 ms 31488 KB Output is correct
35 Correct 762 ms 35624 KB Output is correct
36 Correct 503 ms 19644 KB Output is correct
37 Correct 520 ms 19512 KB Output is correct
38 Correct 678 ms 35320 KB Output is correct
39 Correct 646 ms 26260 KB Output is correct
40 Correct 41 ms 19036 KB Output is correct
41 Correct 58 ms 19276 KB Output is correct
42 Correct 22 ms 19036 KB Output is correct
43 Correct 194 ms 19276 KB Output is correct
44 Correct 670 ms 23156 KB Output is correct
45 Correct 570 ms 26168 KB Output is correct
46 Correct 707 ms 31660 KB Output is correct
47 Correct 690 ms 31508 KB Output is correct
48 Correct 789 ms 35312 KB Output is correct
49 Correct 507 ms 19652 KB Output is correct
50 Correct 521 ms 19524 KB Output is correct
51 Correct 687 ms 34076 KB Output is correct
52 Correct 637 ms 26368 KB Output is correct
53 Correct 646 ms 25216 KB Output is correct
54 Correct 568 ms 25628 KB Output is correct
55 Correct 763 ms 31828 KB Output is correct
56 Correct 671 ms 31548 KB Output is correct
57 Correct 765 ms 32532 KB Output is correct
58 Correct 194 ms 19036 KB Output is correct
59 Correct 644 ms 23148 KB Output is correct
60 Correct 565 ms 26140 KB Output is correct
61 Correct 696 ms 31740 KB Output is correct
62 Correct 686 ms 31504 KB Output is correct
63 Correct 796 ms 35712 KB Output is correct
64 Correct 516 ms 19700 KB Output is correct
65 Correct 513 ms 19528 KB Output is correct
66 Correct 660 ms 35360 KB Output is correct
67 Correct 634 ms 26292 KB Output is correct
68 Correct 825 ms 19036 KB Output is correct
69 Correct 815 ms 19036 KB Output is correct
70 Correct 1098 ms 28904 KB Output is correct
71 Correct 1008 ms 31616 KB Output is correct
72 Correct 1158 ms 33652 KB Output is correct
73 Correct 1134 ms 31812 KB Output is correct
74 Correct 1282 ms 33024 KB Output is correct
75 Correct 1124 ms 25240 KB Output is correct
76 Correct 47 ms 19252 KB Output is correct
77 Correct 55 ms 19036 KB Output is correct
78 Correct 21 ms 19036 KB Output is correct
79 Correct 199 ms 19256 KB Output is correct
80 Correct 2 ms 10844 KB Output is correct
81 Correct 945 ms 19500 KB Output is correct
82 Correct 926 ms 19288 KB Output is correct
83 Correct 953 ms 19760 KB Output is correct
84 Correct 941 ms 19852 KB Output is correct
85 Correct 809 ms 19036 KB Output is correct
86 Correct 813 ms 19036 KB Output is correct
87 Correct 635 ms 23168 KB Output is correct
88 Correct 584 ms 26424 KB Output is correct
89 Correct 684 ms 31940 KB Output is correct
90 Correct 692 ms 31476 KB Output is correct
91 Correct 762 ms 32608 KB Output is correct
92 Correct 497 ms 19680 KB Output is correct
93 Correct 500 ms 19540 KB Output is correct
94 Correct 657 ms 35104 KB Output is correct
95 Correct 615 ms 26272 KB Output is correct
96 Correct 646 ms 25296 KB Output is correct
97 Correct 572 ms 25640 KB Output is correct
98 Correct 779 ms 31840 KB Output is correct
99 Correct 683 ms 31560 KB Output is correct
100 Correct 784 ms 33676 KB Output is correct
101 Correct 1144 ms 28888 KB Output is correct
102 Correct 1040 ms 31576 KB Output is correct
103 Correct 1136 ms 33064 KB Output is correct
104 Correct 1133 ms 31808 KB Output is correct
105 Correct 1266 ms 32544 KB Output is correct
106 Correct 1076 ms 25052 KB Output is correct
107 Correct 1089 ms 25964 KB Output is correct
108 Correct 1101 ms 29044 KB Output is correct
109 Correct 1142 ms 32552 KB Output is correct
110 Correct 1348 ms 35168 KB Output is correct
111 Correct 205 ms 19256 KB Output is correct
112 Correct 672 ms 23128 KB Output is correct
113 Correct 608 ms 26196 KB Output is correct
114 Correct 736 ms 31832 KB Output is correct
115 Correct 726 ms 31460 KB Output is correct
116 Correct 800 ms 32544 KB Output is correct
117 Correct 527 ms 19684 KB Output is correct
118 Correct 515 ms 19516 KB Output is correct
119 Correct 717 ms 35160 KB Output is correct
120 Correct 657 ms 26260 KB Output is correct
121 Correct 876 ms 19264 KB Output is correct
122 Correct 846 ms 19036 KB Output is correct
123 Correct 1120 ms 28872 KB Output is correct
124 Correct 1075 ms 31564 KB Output is correct
125 Correct 1174 ms 34828 KB Output is correct
126 Correct 1177 ms 31868 KB Output is correct
127 Correct 1280 ms 34088 KB Output is correct
128 Correct 1073 ms 25068 KB Output is correct
129 Correct 1621 ms 19152 KB Output is correct
130 Correct 1664 ms 19276 KB Output is correct
131 Correct 2254 ms 32552 KB Output is correct
132 Correct 2029 ms 23852 KB Output is correct
133 Correct 2235 ms 34856 KB Output is correct
134 Correct 2312 ms 31104 KB Output is correct
135 Correct 2565 ms 34860 KB Output is correct
136 Correct 2201 ms 26296 KB Output is correct
137 Correct 40 ms 19036 KB Output is correct
138 Correct 54 ms 19036 KB Output is correct
139 Correct 20 ms 19036 KB Output is correct
140 Correct 192 ms 19256 KB Output is correct
141 Correct 2 ms 10844 KB Output is correct
142 Correct 973 ms 19508 KB Output is correct
143 Correct 919 ms 19284 KB Output is correct
144 Correct 940 ms 19480 KB Output is correct
145 Correct 940 ms 19700 KB Output is correct
146 Correct 813 ms 19036 KB Output is correct
147 Correct 824 ms 19284 KB Output is correct
148 Correct 2 ms 10844 KB Output is correct
149 Correct 1975 ms 20900 KB Output is correct
150 Correct 1972 ms 19824 KB Output is correct
151 Correct 2047 ms 22228 KB Output is correct
152 Correct 2008 ms 22088 KB Output is correct
153 Correct 1627 ms 19256 KB Output is correct
154 Correct 1627 ms 19284 KB Output is correct
155 Correct 672 ms 23128 KB Output is correct
156 Correct 610 ms 26172 KB Output is correct
157 Correct 757 ms 31680 KB Output is correct
158 Correct 720 ms 31520 KB Output is correct
159 Correct 811 ms 32520 KB Output is correct
160 Correct 519 ms 19656 KB Output is correct
161 Correct 530 ms 19540 KB Output is correct
162 Correct 669 ms 33200 KB Output is correct
163 Correct 631 ms 26264 KB Output is correct
164 Correct 1105 ms 28872 KB Output is correct
165 Correct 1035 ms 31600 KB Output is correct
166 Correct 1177 ms 34684 KB Output is correct
167 Correct 1165 ms 31960 KB Output is correct
168 Correct 1274 ms 34392 KB Output is correct
169 Correct 1045 ms 25096 KB Output is correct
170 Correct 660 ms 25212 KB Output is correct
171 Correct 563 ms 25668 KB Output is correct
172 Correct 718 ms 31868 KB Output is correct
173 Correct 652 ms 31564 KB Output is correct
174 Correct 752 ms 34920 KB Output is correct
175 Correct 1065 ms 25924 KB Output is correct
176 Correct 1077 ms 28852 KB Output is correct
177 Correct 1077 ms 34336 KB Output is correct
178 Correct 1242 ms 33480 KB Output is correct
179 Correct 2223 ms 33832 KB Output is correct
180 Correct 2041 ms 23720 KB Output is correct
181 Correct 2249 ms 35356 KB Output is correct
182 Correct 2323 ms 31080 KB Output is correct
183 Correct 2607 ms 33756 KB Output is correct
184 Correct 2219 ms 26296 KB Output is correct
185 Correct 2249 ms 33468 KB Output is correct
186 Correct 2288 ms 31072 KB Output is correct
187 Correct 2616 ms 31556 KB Output is correct
188 Correct 2663 ms 33304 KB Output is correct
189 Correct 198 ms 19264 KB Output is correct
190 Correct 697 ms 23140 KB Output is correct
191 Correct 615 ms 26168 KB Output is correct
192 Correct 745 ms 31636 KB Output is correct
193 Correct 697 ms 31512 KB Output is correct
194 Correct 822 ms 32548 KB Output is correct
195 Correct 523 ms 19656 KB Output is correct
196 Correct 547 ms 19512 KB Output is correct
197 Correct 744 ms 35348 KB Output is correct
198 Correct 683 ms 26228 KB Output is correct
199 Correct 865 ms 19036 KB Output is correct
200 Correct 877 ms 19036 KB Output is correct
201 Correct 1157 ms 28908 KB Output is correct
202 Correct 1061 ms 31500 KB Output is correct
203 Correct 1226 ms 32996 KB Output is correct
204 Correct 1224 ms 33504 KB Output is correct
205 Correct 1343 ms 33316 KB Output is correct
206 Correct 1094 ms 25256 KB Output is correct
207 Correct 1633 ms 19288 KB Output is correct
208 Correct 1603 ms 19288 KB Output is correct
209 Correct 2211 ms 33108 KB Output is correct
210 Correct 2031 ms 23720 KB Output is correct
211 Correct 2241 ms 35628 KB Output is correct
212 Correct 2339 ms 31052 KB Output is correct
213 Correct 2552 ms 34056 KB Output is correct
214 Correct 2162 ms 26296 KB Output is correct
215 Execution timed out 5042 ms 30228 KB Time limit exceeded
216 Halted 0 ms 0 KB -