Submission #1070985

# Submission time Handle Problem Language Result Execution time Memory
1070985 2024-08-22T22:18:56 Z AdamGS Uplifting Excursion (BOI22_vault) C++17
90 / 100
5000 ms 31552 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=8e5+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+=2;
    			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:19: 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:16: 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 36 ms 15056 KB Output is correct
2 Correct 27 ms 14940 KB Output is correct
3 Correct 11 ms 14940 KB Output is correct
4 Correct 77 ms 14812 KB Output is correct
5 Correct 2 ms 8796 KB Output is correct
6 Correct 836 ms 15308 KB Output is correct
7 Correct 378 ms 15192 KB Output is correct
8 Correct 738 ms 15264 KB Output is correct
9 Correct 789 ms 15516 KB Output is correct
10 Correct 19 ms 15068 KB Output is correct
11 Correct 41 ms 14940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 15056 KB Output is correct
2 Correct 27 ms 14940 KB Output is correct
3 Correct 11 ms 14940 KB Output is correct
4 Correct 77 ms 14812 KB Output is correct
5 Correct 2 ms 8796 KB Output is correct
6 Correct 836 ms 15308 KB Output is correct
7 Correct 378 ms 15192 KB Output is correct
8 Correct 738 ms 15264 KB Output is correct
9 Correct 789 ms 15516 KB Output is correct
10 Correct 19 ms 15068 KB Output is correct
11 Correct 41 ms 14940 KB Output is correct
12 Correct 55 ms 15056 KB Output is correct
13 Correct 23 ms 15060 KB Output is correct
14 Correct 10 ms 14940 KB Output is correct
15 Correct 78 ms 14936 KB Output is correct
16 Correct 2 ms 8796 KB Output is correct
17 Correct 765 ms 15276 KB Output is correct
18 Correct 349 ms 15052 KB Output is correct
19 Correct 771 ms 15340 KB Output is correct
20 Correct 834 ms 15348 KB Output is correct
21 Correct 35 ms 15064 KB Output is correct
22 Correct 41 ms 14936 KB Output is correct
23 Correct 2 ms 8792 KB Output is correct
24 Correct 1733 ms 16768 KB Output is correct
25 Correct 645 ms 15488 KB Output is correct
26 Correct 1723 ms 18064 KB Output is correct
27 Correct 1808 ms 18052 KB Output is correct
28 Correct 19 ms 14940 KB Output is correct
29 Correct 65 ms 15044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 14940 KB Output is correct
2 Correct 348 ms 18540 KB Output is correct
3 Correct 99 ms 19364 KB Output is correct
4 Correct 386 ms 25836 KB Output is correct
5 Correct 408 ms 25744 KB Output is correct
6 Correct 443 ms 28328 KB Output is correct
7 Correct 22 ms 15192 KB Output is correct
8 Correct 41 ms 14940 KB Output is correct
9 Correct 259 ms 28864 KB Output is correct
10 Correct 248 ms 21504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 14940 KB Output is correct
2 Correct 348 ms 18540 KB Output is correct
3 Correct 99 ms 19364 KB Output is correct
4 Correct 386 ms 25836 KB Output is correct
5 Correct 408 ms 25744 KB Output is correct
6 Correct 443 ms 28328 KB Output is correct
7 Correct 22 ms 15192 KB Output is correct
8 Correct 41 ms 14940 KB Output is correct
9 Correct 259 ms 28864 KB Output is correct
10 Correct 248 ms 21504 KB Output is correct
11 Correct 37 ms 14940 KB Output is correct
12 Correct 25 ms 14940 KB Output is correct
13 Correct 17 ms 15056 KB Output is correct
14 Correct 110 ms 15044 KB Output is correct
15 Correct 361 ms 18588 KB Output is correct
16 Correct 99 ms 19380 KB Output is correct
17 Correct 384 ms 25712 KB Output is correct
18 Correct 352 ms 25936 KB Output is correct
19 Correct 467 ms 28512 KB Output is correct
20 Correct 19 ms 15196 KB Output is correct
21 Correct 40 ms 14940 KB Output is correct
22 Correct 243 ms 28104 KB Output is correct
23 Correct 272 ms 21472 KB Output is correct
24 Correct 517 ms 20628 KB Output is correct
25 Correct 198 ms 18600 KB Output is correct
26 Correct 628 ms 25944 KB Output is correct
27 Correct 566 ms 26160 KB Output is correct
28 Correct 609 ms 30896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 14940 KB Output is correct
2 Correct 348 ms 18540 KB Output is correct
3 Correct 99 ms 19364 KB Output is correct
4 Correct 386 ms 25836 KB Output is correct
5 Correct 408 ms 25744 KB Output is correct
6 Correct 443 ms 28328 KB Output is correct
7 Correct 22 ms 15192 KB Output is correct
8 Correct 41 ms 14940 KB Output is correct
9 Correct 259 ms 28864 KB Output is correct
10 Correct 248 ms 21504 KB Output is correct
11 Correct 72 ms 14940 KB Output is correct
12 Correct 329 ms 18556 KB Output is correct
13 Correct 98 ms 19308 KB Output is correct
14 Correct 413 ms 25912 KB Output is correct
15 Correct 362 ms 25876 KB Output is correct
16 Correct 443 ms 30824 KB Output is correct
17 Correct 20 ms 15104 KB Output is correct
18 Correct 42 ms 14940 KB Output is correct
19 Correct 234 ms 28532 KB Output is correct
20 Correct 285 ms 21392 KB Output is correct
21 Correct 33 ms 14940 KB Output is correct
22 Correct 40 ms 14940 KB Output is correct
23 Correct 625 ms 23972 KB Output is correct
24 Correct 249 ms 22632 KB Output is correct
25 Correct 641 ms 28228 KB Output is correct
26 Correct 631 ms 26268 KB Output is correct
27 Correct 778 ms 28940 KB Output is correct
28 Correct 445 ms 20416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 15056 KB Output is correct
2 Correct 27 ms 14940 KB Output is correct
3 Correct 11 ms 14940 KB Output is correct
4 Correct 77 ms 14812 KB Output is correct
5 Correct 2 ms 8796 KB Output is correct
6 Correct 836 ms 15308 KB Output is correct
7 Correct 378 ms 15192 KB Output is correct
8 Correct 738 ms 15264 KB Output is correct
9 Correct 789 ms 15516 KB Output is correct
10 Correct 19 ms 15068 KB Output is correct
11 Correct 41 ms 14940 KB Output is correct
12 Correct 80 ms 14940 KB Output is correct
13 Correct 348 ms 18540 KB Output is correct
14 Correct 99 ms 19364 KB Output is correct
15 Correct 386 ms 25836 KB Output is correct
16 Correct 408 ms 25744 KB Output is correct
17 Correct 443 ms 28328 KB Output is correct
18 Correct 22 ms 15192 KB Output is correct
19 Correct 41 ms 14940 KB Output is correct
20 Correct 259 ms 28864 KB Output is correct
21 Correct 248 ms 21504 KB Output is correct
22 Correct 37 ms 14940 KB Output is correct
23 Correct 25 ms 14940 KB Output is correct
24 Correct 17 ms 15056 KB Output is correct
25 Correct 110 ms 15044 KB Output is correct
26 Correct 361 ms 18588 KB Output is correct
27 Correct 99 ms 19380 KB Output is correct
28 Correct 384 ms 25712 KB Output is correct
29 Correct 352 ms 25936 KB Output is correct
30 Correct 467 ms 28512 KB Output is correct
31 Correct 19 ms 15196 KB Output is correct
32 Correct 40 ms 14940 KB Output is correct
33 Correct 243 ms 28104 KB Output is correct
34 Correct 272 ms 21472 KB Output is correct
35 Correct 517 ms 20628 KB Output is correct
36 Correct 198 ms 18600 KB Output is correct
37 Correct 628 ms 25944 KB Output is correct
38 Correct 566 ms 26160 KB Output is correct
39 Correct 609 ms 30896 KB Output is correct
40 Correct 72 ms 14940 KB Output is correct
41 Correct 329 ms 18556 KB Output is correct
42 Correct 98 ms 19308 KB Output is correct
43 Correct 413 ms 25912 KB Output is correct
44 Correct 362 ms 25876 KB Output is correct
45 Correct 443 ms 30824 KB Output is correct
46 Correct 20 ms 15104 KB Output is correct
47 Correct 42 ms 14940 KB Output is correct
48 Correct 234 ms 28532 KB Output is correct
49 Correct 285 ms 21392 KB Output is correct
50 Correct 33 ms 14940 KB Output is correct
51 Correct 40 ms 14940 KB Output is correct
52 Correct 625 ms 23972 KB Output is correct
53 Correct 249 ms 22632 KB Output is correct
54 Correct 641 ms 28228 KB Output is correct
55 Correct 631 ms 26268 KB Output is correct
56 Correct 778 ms 28940 KB Output is correct
57 Correct 445 ms 20416 KB Output is correct
58 Correct 33 ms 14936 KB Output is correct
59 Correct 25 ms 14940 KB Output is correct
60 Correct 10 ms 15056 KB Output is correct
61 Correct 75 ms 15036 KB Output is correct
62 Correct 2 ms 8792 KB Output is correct
63 Correct 792 ms 15276 KB Output is correct
64 Correct 334 ms 15192 KB Output is correct
65 Correct 810 ms 15288 KB Output is correct
66 Correct 771 ms 15496 KB Output is correct
67 Correct 18 ms 14936 KB Output is correct
68 Correct 66 ms 14940 KB Output is correct
69 Correct 353 ms 18532 KB Output is correct
70 Correct 130 ms 19364 KB Output is correct
71 Correct 385 ms 25716 KB Output is correct
72 Correct 385 ms 25752 KB Output is correct
73 Correct 454 ms 29752 KB Output is correct
74 Correct 21 ms 15204 KB Output is correct
75 Correct 47 ms 14936 KB Output is correct
76 Correct 258 ms 29860 KB Output is correct
77 Correct 234 ms 21384 KB Output is correct
78 Correct 550 ms 20504 KB Output is correct
79 Correct 227 ms 18596 KB Output is correct
80 Correct 609 ms 25932 KB Output is correct
81 Correct 538 ms 25952 KB Output is correct
82 Correct 648 ms 28028 KB Output is correct
83 Correct 593 ms 23924 KB Output is correct
84 Correct 299 ms 22632 KB Output is correct
85 Correct 604 ms 31364 KB Output is correct
86 Correct 654 ms 26168 KB Output is correct
87 Correct 747 ms 31388 KB Output is correct
88 Correct 491 ms 20560 KB Output is correct
89 Correct 1014 ms 21188 KB Output is correct
90 Correct 909 ms 21100 KB Output is correct
91 Correct 876 ms 31084 KB Output is correct
92 Correct 1106 ms 29560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 14940 KB Output is correct
2 Correct 348 ms 18540 KB Output is correct
3 Correct 99 ms 19364 KB Output is correct
4 Correct 386 ms 25836 KB Output is correct
5 Correct 408 ms 25744 KB Output is correct
6 Correct 443 ms 28328 KB Output is correct
7 Correct 22 ms 15192 KB Output is correct
8 Correct 41 ms 14940 KB Output is correct
9 Correct 259 ms 28864 KB Output is correct
10 Correct 248 ms 21504 KB Output is correct
11 Correct 72 ms 14940 KB Output is correct
12 Correct 329 ms 18556 KB Output is correct
13 Correct 98 ms 19308 KB Output is correct
14 Correct 413 ms 25912 KB Output is correct
15 Correct 362 ms 25876 KB Output is correct
16 Correct 443 ms 30824 KB Output is correct
17 Correct 20 ms 15104 KB Output is correct
18 Correct 42 ms 14940 KB Output is correct
19 Correct 234 ms 28532 KB Output is correct
20 Correct 285 ms 21392 KB Output is correct
21 Correct 33 ms 14940 KB Output is correct
22 Correct 40 ms 14940 KB Output is correct
23 Correct 625 ms 23972 KB Output is correct
24 Correct 249 ms 22632 KB Output is correct
25 Correct 641 ms 28228 KB Output is correct
26 Correct 631 ms 26268 KB Output is correct
27 Correct 778 ms 28940 KB Output is correct
28 Correct 445 ms 20416 KB Output is correct
29 Correct 78 ms 14940 KB Output is correct
30 Correct 337 ms 18540 KB Output is correct
31 Correct 137 ms 19368 KB Output is correct
32 Correct 391 ms 25716 KB Output is correct
33 Correct 373 ms 25868 KB Output is correct
34 Correct 433 ms 31452 KB Output is correct
35 Correct 36 ms 15184 KB Output is correct
36 Correct 44 ms 14936 KB Output is correct
37 Correct 248 ms 29880 KB Output is correct
38 Correct 254 ms 21344 KB Output is correct
39 Correct 33 ms 14936 KB Output is correct
40 Correct 43 ms 14936 KB Output is correct
41 Correct 624 ms 23968 KB Output is correct
42 Correct 265 ms 22772 KB Output is correct
43 Correct 623 ms 31428 KB Output is correct
44 Correct 654 ms 26144 KB Output is correct
45 Correct 729 ms 30344 KB Output is correct
46 Correct 487 ms 20528 KB Output is correct
47 Correct 18 ms 14936 KB Output is correct
48 Correct 75 ms 14936 KB Output is correct
49 Correct 1169 ms 30572 KB Output is correct
50 Correct 526 ms 19100 KB Output is correct
51 Correct 1164 ms 29756 KB Output is correct
52 Correct 1367 ms 27248 KB Output is correct
53 Correct 1582 ms 28260 KB Output is correct
54 Correct 1063 ms 21652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 15056 KB Output is correct
2 Correct 27 ms 14940 KB Output is correct
3 Correct 11 ms 14940 KB Output is correct
4 Correct 77 ms 14812 KB Output is correct
5 Correct 2 ms 8796 KB Output is correct
6 Correct 836 ms 15308 KB Output is correct
7 Correct 378 ms 15192 KB Output is correct
8 Correct 738 ms 15264 KB Output is correct
9 Correct 789 ms 15516 KB Output is correct
10 Correct 19 ms 15068 KB Output is correct
11 Correct 41 ms 14940 KB Output is correct
12 Correct 55 ms 15056 KB Output is correct
13 Correct 23 ms 15060 KB Output is correct
14 Correct 10 ms 14940 KB Output is correct
15 Correct 78 ms 14936 KB Output is correct
16 Correct 2 ms 8796 KB Output is correct
17 Correct 765 ms 15276 KB Output is correct
18 Correct 349 ms 15052 KB Output is correct
19 Correct 771 ms 15340 KB Output is correct
20 Correct 834 ms 15348 KB Output is correct
21 Correct 35 ms 15064 KB Output is correct
22 Correct 41 ms 14936 KB Output is correct
23 Correct 2 ms 8792 KB Output is correct
24 Correct 1733 ms 16768 KB Output is correct
25 Correct 645 ms 15488 KB Output is correct
26 Correct 1723 ms 18064 KB Output is correct
27 Correct 1808 ms 18052 KB Output is correct
28 Correct 19 ms 14940 KB Output is correct
29 Correct 65 ms 15044 KB Output is correct
30 Correct 80 ms 14940 KB Output is correct
31 Correct 348 ms 18540 KB Output is correct
32 Correct 99 ms 19364 KB Output is correct
33 Correct 386 ms 25836 KB Output is correct
34 Correct 408 ms 25744 KB Output is correct
35 Correct 443 ms 28328 KB Output is correct
36 Correct 22 ms 15192 KB Output is correct
37 Correct 41 ms 14940 KB Output is correct
38 Correct 259 ms 28864 KB Output is correct
39 Correct 248 ms 21504 KB Output is correct
40 Correct 37 ms 14940 KB Output is correct
41 Correct 25 ms 14940 KB Output is correct
42 Correct 17 ms 15056 KB Output is correct
43 Correct 110 ms 15044 KB Output is correct
44 Correct 361 ms 18588 KB Output is correct
45 Correct 99 ms 19380 KB Output is correct
46 Correct 384 ms 25712 KB Output is correct
47 Correct 352 ms 25936 KB Output is correct
48 Correct 467 ms 28512 KB Output is correct
49 Correct 19 ms 15196 KB Output is correct
50 Correct 40 ms 14940 KB Output is correct
51 Correct 243 ms 28104 KB Output is correct
52 Correct 272 ms 21472 KB Output is correct
53 Correct 517 ms 20628 KB Output is correct
54 Correct 198 ms 18600 KB Output is correct
55 Correct 628 ms 25944 KB Output is correct
56 Correct 566 ms 26160 KB Output is correct
57 Correct 609 ms 30896 KB Output is correct
58 Correct 72 ms 14940 KB Output is correct
59 Correct 329 ms 18556 KB Output is correct
60 Correct 98 ms 19308 KB Output is correct
61 Correct 413 ms 25912 KB Output is correct
62 Correct 362 ms 25876 KB Output is correct
63 Correct 443 ms 30824 KB Output is correct
64 Correct 20 ms 15104 KB Output is correct
65 Correct 42 ms 14940 KB Output is correct
66 Correct 234 ms 28532 KB Output is correct
67 Correct 285 ms 21392 KB Output is correct
68 Correct 33 ms 14940 KB Output is correct
69 Correct 40 ms 14940 KB Output is correct
70 Correct 625 ms 23972 KB Output is correct
71 Correct 249 ms 22632 KB Output is correct
72 Correct 641 ms 28228 KB Output is correct
73 Correct 631 ms 26268 KB Output is correct
74 Correct 778 ms 28940 KB Output is correct
75 Correct 445 ms 20416 KB Output is correct
76 Correct 33 ms 14936 KB Output is correct
77 Correct 25 ms 14940 KB Output is correct
78 Correct 10 ms 15056 KB Output is correct
79 Correct 75 ms 15036 KB Output is correct
80 Correct 2 ms 8792 KB Output is correct
81 Correct 792 ms 15276 KB Output is correct
82 Correct 334 ms 15192 KB Output is correct
83 Correct 810 ms 15288 KB Output is correct
84 Correct 771 ms 15496 KB Output is correct
85 Correct 18 ms 14936 KB Output is correct
86 Correct 66 ms 14940 KB Output is correct
87 Correct 353 ms 18532 KB Output is correct
88 Correct 130 ms 19364 KB Output is correct
89 Correct 385 ms 25716 KB Output is correct
90 Correct 385 ms 25752 KB Output is correct
91 Correct 454 ms 29752 KB Output is correct
92 Correct 21 ms 15204 KB Output is correct
93 Correct 47 ms 14936 KB Output is correct
94 Correct 258 ms 29860 KB Output is correct
95 Correct 234 ms 21384 KB Output is correct
96 Correct 550 ms 20504 KB Output is correct
97 Correct 227 ms 18596 KB Output is correct
98 Correct 609 ms 25932 KB Output is correct
99 Correct 538 ms 25952 KB Output is correct
100 Correct 648 ms 28028 KB Output is correct
101 Correct 593 ms 23924 KB Output is correct
102 Correct 299 ms 22632 KB Output is correct
103 Correct 604 ms 31364 KB Output is correct
104 Correct 654 ms 26168 KB Output is correct
105 Correct 747 ms 31388 KB Output is correct
106 Correct 491 ms 20560 KB Output is correct
107 Correct 1014 ms 21188 KB Output is correct
108 Correct 909 ms 21100 KB Output is correct
109 Correct 876 ms 31084 KB Output is correct
110 Correct 1106 ms 29560 KB Output is correct
111 Correct 78 ms 14940 KB Output is correct
112 Correct 337 ms 18540 KB Output is correct
113 Correct 137 ms 19368 KB Output is correct
114 Correct 391 ms 25716 KB Output is correct
115 Correct 373 ms 25868 KB Output is correct
116 Correct 433 ms 31452 KB Output is correct
117 Correct 36 ms 15184 KB Output is correct
118 Correct 44 ms 14936 KB Output is correct
119 Correct 248 ms 29880 KB Output is correct
120 Correct 254 ms 21344 KB Output is correct
121 Correct 33 ms 14936 KB Output is correct
122 Correct 43 ms 14936 KB Output is correct
123 Correct 624 ms 23968 KB Output is correct
124 Correct 265 ms 22772 KB Output is correct
125 Correct 623 ms 31428 KB Output is correct
126 Correct 654 ms 26144 KB Output is correct
127 Correct 729 ms 30344 KB Output is correct
128 Correct 487 ms 20528 KB Output is correct
129 Correct 18 ms 14936 KB Output is correct
130 Correct 75 ms 14936 KB Output is correct
131 Correct 1169 ms 30572 KB Output is correct
132 Correct 526 ms 19100 KB Output is correct
133 Correct 1164 ms 29756 KB Output is correct
134 Correct 1367 ms 27248 KB Output is correct
135 Correct 1582 ms 28260 KB Output is correct
136 Correct 1063 ms 21652 KB Output is correct
137 Correct 58 ms 14940 KB Output is correct
138 Correct 26 ms 14936 KB Output is correct
139 Correct 12 ms 14936 KB Output is correct
140 Correct 77 ms 14940 KB Output is correct
141 Correct 2 ms 8792 KB Output is correct
142 Correct 840 ms 15296 KB Output is correct
143 Correct 351 ms 15188 KB Output is correct
144 Correct 790 ms 15272 KB Output is correct
145 Correct 779 ms 15360 KB Output is correct
146 Correct 17 ms 14940 KB Output is correct
147 Correct 42 ms 14940 KB Output is correct
148 Correct 2 ms 8796 KB Output is correct
149 Correct 1609 ms 16668 KB Output is correct
150 Correct 633 ms 15464 KB Output is correct
151 Correct 1726 ms 17996 KB Output is correct
152 Correct 1696 ms 18048 KB Output is correct
153 Correct 20 ms 14940 KB Output is correct
154 Correct 39 ms 14940 KB Output is correct
155 Correct 343 ms 18532 KB Output is correct
156 Correct 91 ms 19340 KB Output is correct
157 Correct 366 ms 25708 KB Output is correct
158 Correct 365 ms 25736 KB Output is correct
159 Correct 431 ms 30452 KB Output is correct
160 Correct 22 ms 15192 KB Output is correct
161 Correct 44 ms 15056 KB Output is correct
162 Correct 230 ms 29024 KB Output is correct
163 Correct 246 ms 21276 KB Output is correct
164 Correct 596 ms 23808 KB Output is correct
165 Correct 272 ms 22644 KB Output is correct
166 Correct 588 ms 30372 KB Output is correct
167 Correct 673 ms 26184 KB Output is correct
168 Correct 695 ms 28864 KB Output is correct
169 Correct 431 ms 20540 KB Output is correct
170 Correct 511 ms 20640 KB Output is correct
171 Correct 189 ms 18600 KB Output is correct
172 Correct 581 ms 25944 KB Output is correct
173 Correct 509 ms 25932 KB Output is correct
174 Correct 590 ms 31552 KB Output is correct
175 Correct 867 ms 21200 KB Output is correct
176 Correct 853 ms 21112 KB Output is correct
177 Correct 827 ms 30868 KB Output is correct
178 Correct 956 ms 28872 KB Output is correct
179 Correct 1089 ms 29348 KB Output is correct
180 Correct 450 ms 19108 KB Output is correct
181 Correct 1100 ms 31176 KB Output is correct
182 Correct 1158 ms 25712 KB Output is correct
183 Correct 1386 ms 30528 KB Output is correct
184 Correct 970 ms 21668 KB Output is correct
185 Correct 1728 ms 26136 KB Output is correct
186 Correct 1724 ms 25780 KB Output is correct
187 Correct 1920 ms 26180 KB Output is correct
188 Correct 1974 ms 30264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 14940 KB Output is correct
2 Correct 348 ms 18540 KB Output is correct
3 Correct 99 ms 19364 KB Output is correct
4 Correct 386 ms 25836 KB Output is correct
5 Correct 408 ms 25744 KB Output is correct
6 Correct 443 ms 28328 KB Output is correct
7 Correct 22 ms 15192 KB Output is correct
8 Correct 41 ms 14940 KB Output is correct
9 Correct 259 ms 28864 KB Output is correct
10 Correct 248 ms 21504 KB Output is correct
11 Correct 72 ms 14940 KB Output is correct
12 Correct 329 ms 18556 KB Output is correct
13 Correct 98 ms 19308 KB Output is correct
14 Correct 413 ms 25912 KB Output is correct
15 Correct 362 ms 25876 KB Output is correct
16 Correct 443 ms 30824 KB Output is correct
17 Correct 20 ms 15104 KB Output is correct
18 Correct 42 ms 14940 KB Output is correct
19 Correct 234 ms 28532 KB Output is correct
20 Correct 285 ms 21392 KB Output is correct
21 Correct 33 ms 14940 KB Output is correct
22 Correct 40 ms 14940 KB Output is correct
23 Correct 625 ms 23972 KB Output is correct
24 Correct 249 ms 22632 KB Output is correct
25 Correct 641 ms 28228 KB Output is correct
26 Correct 631 ms 26268 KB Output is correct
27 Correct 778 ms 28940 KB Output is correct
28 Correct 445 ms 20416 KB Output is correct
29 Correct 78 ms 14940 KB Output is correct
30 Correct 337 ms 18540 KB Output is correct
31 Correct 137 ms 19368 KB Output is correct
32 Correct 391 ms 25716 KB Output is correct
33 Correct 373 ms 25868 KB Output is correct
34 Correct 433 ms 31452 KB Output is correct
35 Correct 36 ms 15184 KB Output is correct
36 Correct 44 ms 14936 KB Output is correct
37 Correct 248 ms 29880 KB Output is correct
38 Correct 254 ms 21344 KB Output is correct
39 Correct 33 ms 14936 KB Output is correct
40 Correct 43 ms 14936 KB Output is correct
41 Correct 624 ms 23968 KB Output is correct
42 Correct 265 ms 22772 KB Output is correct
43 Correct 623 ms 31428 KB Output is correct
44 Correct 654 ms 26144 KB Output is correct
45 Correct 729 ms 30344 KB Output is correct
46 Correct 487 ms 20528 KB Output is correct
47 Correct 18 ms 14936 KB Output is correct
48 Correct 75 ms 14936 KB Output is correct
49 Correct 1169 ms 30572 KB Output is correct
50 Correct 526 ms 19100 KB Output is correct
51 Correct 1164 ms 29756 KB Output is correct
52 Correct 1367 ms 27248 KB Output is correct
53 Correct 1582 ms 28260 KB Output is correct
54 Correct 1063 ms 21652 KB Output is correct
55 Correct 76 ms 14936 KB Output is correct
56 Correct 318 ms 18508 KB Output is correct
57 Correct 89 ms 19368 KB Output is correct
58 Correct 355 ms 25840 KB Output is correct
59 Correct 350 ms 25756 KB Output is correct
60 Correct 402 ms 28852 KB Output is correct
61 Correct 20 ms 15196 KB Output is correct
62 Correct 40 ms 14936 KB Output is correct
63 Correct 228 ms 28748 KB Output is correct
64 Correct 234 ms 21508 KB Output is correct
65 Correct 19 ms 14940 KB Output is correct
66 Correct 38 ms 14940 KB Output is correct
67 Correct 563 ms 23944 KB Output is correct
68 Correct 240 ms 22552 KB Output is correct
69 Correct 579 ms 28516 KB Output is correct
70 Correct 566 ms 26336 KB Output is correct
71 Correct 672 ms 27980 KB Output is correct
72 Correct 415 ms 20524 KB Output is correct
73 Correct 17 ms 14936 KB Output is correct
74 Correct 37 ms 14940 KB Output is correct
75 Correct 1077 ms 30752 KB Output is correct
76 Correct 451 ms 19088 KB Output is correct
77 Correct 1095 ms 28764 KB Output is correct
78 Correct 1176 ms 25744 KB Output is correct
79 Correct 1319 ms 29500 KB Output is correct
80 Correct 943 ms 21520 KB Output is correct
81 Correct 3306 ms 21396 KB Output is correct
82 Correct 1504 ms 18440 KB Output is correct
83 Correct 3306 ms 26296 KB Output is correct
84 Correct 3510 ms 29968 KB Output is correct
85 Correct 19 ms 15080 KB Output is correct
86 Correct 38 ms 14940 KB Output is correct
87 Correct 2954 ms 21176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 15056 KB Output is correct
2 Correct 27 ms 14940 KB Output is correct
3 Correct 11 ms 14940 KB Output is correct
4 Correct 77 ms 14812 KB Output is correct
5 Correct 2 ms 8796 KB Output is correct
6 Correct 836 ms 15308 KB Output is correct
7 Correct 378 ms 15192 KB Output is correct
8 Correct 738 ms 15264 KB Output is correct
9 Correct 789 ms 15516 KB Output is correct
10 Correct 19 ms 15068 KB Output is correct
11 Correct 41 ms 14940 KB Output is correct
12 Correct 55 ms 15056 KB Output is correct
13 Correct 23 ms 15060 KB Output is correct
14 Correct 10 ms 14940 KB Output is correct
15 Correct 78 ms 14936 KB Output is correct
16 Correct 2 ms 8796 KB Output is correct
17 Correct 765 ms 15276 KB Output is correct
18 Correct 349 ms 15052 KB Output is correct
19 Correct 771 ms 15340 KB Output is correct
20 Correct 834 ms 15348 KB Output is correct
21 Correct 35 ms 15064 KB Output is correct
22 Correct 41 ms 14936 KB Output is correct
23 Correct 2 ms 8792 KB Output is correct
24 Correct 1733 ms 16768 KB Output is correct
25 Correct 645 ms 15488 KB Output is correct
26 Correct 1723 ms 18064 KB Output is correct
27 Correct 1808 ms 18052 KB Output is correct
28 Correct 19 ms 14940 KB Output is correct
29 Correct 65 ms 15044 KB Output is correct
30 Correct 80 ms 14940 KB Output is correct
31 Correct 348 ms 18540 KB Output is correct
32 Correct 99 ms 19364 KB Output is correct
33 Correct 386 ms 25836 KB Output is correct
34 Correct 408 ms 25744 KB Output is correct
35 Correct 443 ms 28328 KB Output is correct
36 Correct 22 ms 15192 KB Output is correct
37 Correct 41 ms 14940 KB Output is correct
38 Correct 259 ms 28864 KB Output is correct
39 Correct 248 ms 21504 KB Output is correct
40 Correct 37 ms 14940 KB Output is correct
41 Correct 25 ms 14940 KB Output is correct
42 Correct 17 ms 15056 KB Output is correct
43 Correct 110 ms 15044 KB Output is correct
44 Correct 361 ms 18588 KB Output is correct
45 Correct 99 ms 19380 KB Output is correct
46 Correct 384 ms 25712 KB Output is correct
47 Correct 352 ms 25936 KB Output is correct
48 Correct 467 ms 28512 KB Output is correct
49 Correct 19 ms 15196 KB Output is correct
50 Correct 40 ms 14940 KB Output is correct
51 Correct 243 ms 28104 KB Output is correct
52 Correct 272 ms 21472 KB Output is correct
53 Correct 517 ms 20628 KB Output is correct
54 Correct 198 ms 18600 KB Output is correct
55 Correct 628 ms 25944 KB Output is correct
56 Correct 566 ms 26160 KB Output is correct
57 Correct 609 ms 30896 KB Output is correct
58 Correct 72 ms 14940 KB Output is correct
59 Correct 329 ms 18556 KB Output is correct
60 Correct 98 ms 19308 KB Output is correct
61 Correct 413 ms 25912 KB Output is correct
62 Correct 362 ms 25876 KB Output is correct
63 Correct 443 ms 30824 KB Output is correct
64 Correct 20 ms 15104 KB Output is correct
65 Correct 42 ms 14940 KB Output is correct
66 Correct 234 ms 28532 KB Output is correct
67 Correct 285 ms 21392 KB Output is correct
68 Correct 33 ms 14940 KB Output is correct
69 Correct 40 ms 14940 KB Output is correct
70 Correct 625 ms 23972 KB Output is correct
71 Correct 249 ms 22632 KB Output is correct
72 Correct 641 ms 28228 KB Output is correct
73 Correct 631 ms 26268 KB Output is correct
74 Correct 778 ms 28940 KB Output is correct
75 Correct 445 ms 20416 KB Output is correct
76 Correct 33 ms 14936 KB Output is correct
77 Correct 25 ms 14940 KB Output is correct
78 Correct 10 ms 15056 KB Output is correct
79 Correct 75 ms 15036 KB Output is correct
80 Correct 2 ms 8792 KB Output is correct
81 Correct 792 ms 15276 KB Output is correct
82 Correct 334 ms 15192 KB Output is correct
83 Correct 810 ms 15288 KB Output is correct
84 Correct 771 ms 15496 KB Output is correct
85 Correct 18 ms 14936 KB Output is correct
86 Correct 66 ms 14940 KB Output is correct
87 Correct 353 ms 18532 KB Output is correct
88 Correct 130 ms 19364 KB Output is correct
89 Correct 385 ms 25716 KB Output is correct
90 Correct 385 ms 25752 KB Output is correct
91 Correct 454 ms 29752 KB Output is correct
92 Correct 21 ms 15204 KB Output is correct
93 Correct 47 ms 14936 KB Output is correct
94 Correct 258 ms 29860 KB Output is correct
95 Correct 234 ms 21384 KB Output is correct
96 Correct 550 ms 20504 KB Output is correct
97 Correct 227 ms 18596 KB Output is correct
98 Correct 609 ms 25932 KB Output is correct
99 Correct 538 ms 25952 KB Output is correct
100 Correct 648 ms 28028 KB Output is correct
101 Correct 593 ms 23924 KB Output is correct
102 Correct 299 ms 22632 KB Output is correct
103 Correct 604 ms 31364 KB Output is correct
104 Correct 654 ms 26168 KB Output is correct
105 Correct 747 ms 31388 KB Output is correct
106 Correct 491 ms 20560 KB Output is correct
107 Correct 1014 ms 21188 KB Output is correct
108 Correct 909 ms 21100 KB Output is correct
109 Correct 876 ms 31084 KB Output is correct
110 Correct 1106 ms 29560 KB Output is correct
111 Correct 78 ms 14940 KB Output is correct
112 Correct 337 ms 18540 KB Output is correct
113 Correct 137 ms 19368 KB Output is correct
114 Correct 391 ms 25716 KB Output is correct
115 Correct 373 ms 25868 KB Output is correct
116 Correct 433 ms 31452 KB Output is correct
117 Correct 36 ms 15184 KB Output is correct
118 Correct 44 ms 14936 KB Output is correct
119 Correct 248 ms 29880 KB Output is correct
120 Correct 254 ms 21344 KB Output is correct
121 Correct 33 ms 14936 KB Output is correct
122 Correct 43 ms 14936 KB Output is correct
123 Correct 624 ms 23968 KB Output is correct
124 Correct 265 ms 22772 KB Output is correct
125 Correct 623 ms 31428 KB Output is correct
126 Correct 654 ms 26144 KB Output is correct
127 Correct 729 ms 30344 KB Output is correct
128 Correct 487 ms 20528 KB Output is correct
129 Correct 18 ms 14936 KB Output is correct
130 Correct 75 ms 14936 KB Output is correct
131 Correct 1169 ms 30572 KB Output is correct
132 Correct 526 ms 19100 KB Output is correct
133 Correct 1164 ms 29756 KB Output is correct
134 Correct 1367 ms 27248 KB Output is correct
135 Correct 1582 ms 28260 KB Output is correct
136 Correct 1063 ms 21652 KB Output is correct
137 Correct 58 ms 14940 KB Output is correct
138 Correct 26 ms 14936 KB Output is correct
139 Correct 12 ms 14936 KB Output is correct
140 Correct 77 ms 14940 KB Output is correct
141 Correct 2 ms 8792 KB Output is correct
142 Correct 840 ms 15296 KB Output is correct
143 Correct 351 ms 15188 KB Output is correct
144 Correct 790 ms 15272 KB Output is correct
145 Correct 779 ms 15360 KB Output is correct
146 Correct 17 ms 14940 KB Output is correct
147 Correct 42 ms 14940 KB Output is correct
148 Correct 2 ms 8796 KB Output is correct
149 Correct 1609 ms 16668 KB Output is correct
150 Correct 633 ms 15464 KB Output is correct
151 Correct 1726 ms 17996 KB Output is correct
152 Correct 1696 ms 18048 KB Output is correct
153 Correct 20 ms 14940 KB Output is correct
154 Correct 39 ms 14940 KB Output is correct
155 Correct 343 ms 18532 KB Output is correct
156 Correct 91 ms 19340 KB Output is correct
157 Correct 366 ms 25708 KB Output is correct
158 Correct 365 ms 25736 KB Output is correct
159 Correct 431 ms 30452 KB Output is correct
160 Correct 22 ms 15192 KB Output is correct
161 Correct 44 ms 15056 KB Output is correct
162 Correct 230 ms 29024 KB Output is correct
163 Correct 246 ms 21276 KB Output is correct
164 Correct 596 ms 23808 KB Output is correct
165 Correct 272 ms 22644 KB Output is correct
166 Correct 588 ms 30372 KB Output is correct
167 Correct 673 ms 26184 KB Output is correct
168 Correct 695 ms 28864 KB Output is correct
169 Correct 431 ms 20540 KB Output is correct
170 Correct 511 ms 20640 KB Output is correct
171 Correct 189 ms 18600 KB Output is correct
172 Correct 581 ms 25944 KB Output is correct
173 Correct 509 ms 25932 KB Output is correct
174 Correct 590 ms 31552 KB Output is correct
175 Correct 867 ms 21200 KB Output is correct
176 Correct 853 ms 21112 KB Output is correct
177 Correct 827 ms 30868 KB Output is correct
178 Correct 956 ms 28872 KB Output is correct
179 Correct 1089 ms 29348 KB Output is correct
180 Correct 450 ms 19108 KB Output is correct
181 Correct 1100 ms 31176 KB Output is correct
182 Correct 1158 ms 25712 KB Output is correct
183 Correct 1386 ms 30528 KB Output is correct
184 Correct 970 ms 21668 KB Output is correct
185 Correct 1728 ms 26136 KB Output is correct
186 Correct 1724 ms 25780 KB Output is correct
187 Correct 1920 ms 26180 KB Output is correct
188 Correct 1974 ms 30264 KB Output is correct
189 Correct 76 ms 14936 KB Output is correct
190 Correct 318 ms 18508 KB Output is correct
191 Correct 89 ms 19368 KB Output is correct
192 Correct 355 ms 25840 KB Output is correct
193 Correct 350 ms 25756 KB Output is correct
194 Correct 402 ms 28852 KB Output is correct
195 Correct 20 ms 15196 KB Output is correct
196 Correct 40 ms 14936 KB Output is correct
197 Correct 228 ms 28748 KB Output is correct
198 Correct 234 ms 21508 KB Output is correct
199 Correct 19 ms 14940 KB Output is correct
200 Correct 38 ms 14940 KB Output is correct
201 Correct 563 ms 23944 KB Output is correct
202 Correct 240 ms 22552 KB Output is correct
203 Correct 579 ms 28516 KB Output is correct
204 Correct 566 ms 26336 KB Output is correct
205 Correct 672 ms 27980 KB Output is correct
206 Correct 415 ms 20524 KB Output is correct
207 Correct 17 ms 14936 KB Output is correct
208 Correct 37 ms 14940 KB Output is correct
209 Correct 1077 ms 30752 KB Output is correct
210 Correct 451 ms 19088 KB Output is correct
211 Correct 1095 ms 28764 KB Output is correct
212 Correct 1176 ms 25744 KB Output is correct
213 Correct 1319 ms 29500 KB Output is correct
214 Correct 943 ms 21520 KB Output is correct
215 Correct 3306 ms 21396 KB Output is correct
216 Correct 1504 ms 18440 KB Output is correct
217 Correct 3306 ms 26296 KB Output is correct
218 Correct 3510 ms 29968 KB Output is correct
219 Correct 19 ms 15080 KB Output is correct
220 Correct 38 ms 14940 KB Output is correct
221 Correct 2954 ms 21176 KB Output is correct
222 Correct 74 ms 14936 KB Output is correct
223 Correct 327 ms 18564 KB Output is correct
224 Correct 93 ms 19396 KB Output is correct
225 Correct 350 ms 25720 KB Output is correct
226 Correct 346 ms 25888 KB Output is correct
227 Correct 402 ms 28028 KB Output is correct
228 Correct 19 ms 15196 KB Output is correct
229 Correct 38 ms 14940 KB Output is correct
230 Correct 225 ms 31288 KB Output is correct
231 Correct 235 ms 21488 KB Output is correct
232 Correct 18 ms 14940 KB Output is correct
233 Correct 38 ms 14936 KB Output is correct
234 Correct 564 ms 24088 KB Output is correct
235 Correct 234 ms 22716 KB Output is correct
236 Correct 577 ms 29236 KB Output is correct
237 Correct 577 ms 26148 KB Output is correct
238 Correct 684 ms 31420 KB Output is correct
239 Correct 421 ms 20568 KB Output is correct
240 Correct 18 ms 14936 KB Output is correct
241 Correct 38 ms 14940 KB Output is correct
242 Correct 1135 ms 29716 KB Output is correct
243 Correct 491 ms 18980 KB Output is correct
244 Correct 1115 ms 29132 KB Output is correct
245 Correct 1182 ms 25712 KB Output is correct
246 Correct 1350 ms 30420 KB Output is correct
247 Correct 965 ms 21636 KB Output is correct
248 Correct 33 ms 14936 KB Output is correct
249 Correct 23 ms 14940 KB Output is correct
250 Correct 10 ms 14940 KB Output is correct
251 Correct 1 ms 8796 KB Output is correct
252 Correct 751 ms 15292 KB Output is correct
253 Correct 328 ms 15184 KB Output is correct
254 Correct 748 ms 15288 KB Output is correct
255 Correct 755 ms 15492 KB Output is correct
256 Correct 2 ms 8792 KB Output is correct
257 Correct 1576 ms 16652 KB Output is correct
258 Correct 643 ms 15456 KB Output is correct
259 Correct 1618 ms 17924 KB Output is correct
260 Correct 1634 ms 17968 KB Output is correct
261 Correct 529 ms 20768 KB Output is correct
262 Correct 185 ms 18584 KB Output is correct
263 Correct 576 ms 25944 KB Output is correct
264 Correct 507 ms 26064 KB Output is correct
265 Correct 559 ms 28304 KB Output is correct
266 Correct 847 ms 21212 KB Output is correct
267 Correct 852 ms 20984 KB Output is correct
268 Correct 850 ms 29980 KB Output is correct
269 Correct 947 ms 30556 KB Output is correct
270 Correct 1675 ms 26220 KB Output is correct
271 Correct 1726 ms 25716 KB Output is correct
272 Correct 1936 ms 26156 KB Output is correct
273 Correct 1963 ms 28800 KB Output is correct
274 Correct 3364 ms 21376 KB Output is correct
275 Correct 1553 ms 18444 KB Output is correct
276 Correct 3318 ms 26280 KB Output is correct
277 Correct 3444 ms 29252 KB Output is correct
278 Correct 18 ms 14940 KB Output is correct
279 Correct 36 ms 14940 KB Output is correct
280 Correct 2848 ms 21204 KB Output is correct
281 Execution timed out 5047 ms 19976 KB Time limit exceeded
282 Halted 0 ms 0 KB -