# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1019620 |
2024-07-11T05:20:40 Z |
변재우(#10911) |
Uplifting Excursion (BOI22_vault) |
C++17 |
|
971 ms |
10072 KB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF=1e18;
int M, L, A[210], D[1200010];
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>M>>L;
for(int i=0; i<=2*M; i++) cin>>A[i];
for(int j=0; j<=1200000; j++) D[j]=-INF;
D[600000]=0;
for(int i=-M; i<=M; i++) {
int t=0;
for(int k=0; k<=5; k++) if(A[i+M]>=(1<<(k+1))-1) {
t=(1<<(k+1))-1;
if(i>0) for(int j=1200000; j>=(i<<k); j--) D[j]=max(D[j], D[j-(i<<k)]+(1<<k));
else for(int j=0; j<=1200000+(i<<k); j++) D[j]=max(D[j], D[j-(i<<k)]+(1<<k));
}
t=A[i+M]-t;
if(!t) continue;
if(i>0) for(int j=1200000; j>=i*t; j--) D[j]=max(D[j], D[j-i*t]+t);
else for(int j=0; j<=1200000+i*t; j++) D[j]=max(D[j], D[j-i*t]+t);
}
if(abs(L)<=600000 && D[600000+L]>=0) cout<<D[600000+L]<<"\n";
else cout<<"impossible";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
9820 KB |
Output is correct |
2 |
Correct |
8 ms |
9820 KB |
Output is correct |
3 |
Correct |
5 ms |
9628 KB |
Output is correct |
4 |
Correct |
23 ms |
9820 KB |
Output is correct |
5 |
Correct |
321 ms |
9820 KB |
Output is correct |
6 |
Correct |
313 ms |
9816 KB |
Output is correct |
7 |
Correct |
149 ms |
9816 KB |
Output is correct |
8 |
Correct |
314 ms |
9820 KB |
Output is correct |
9 |
Correct |
373 ms |
9816 KB |
Output is correct |
10 |
Correct |
14 ms |
9844 KB |
Output is correct |
11 |
Correct |
15 ms |
9820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
9820 KB |
Output is correct |
2 |
Correct |
8 ms |
9820 KB |
Output is correct |
3 |
Correct |
5 ms |
9628 KB |
Output is correct |
4 |
Correct |
23 ms |
9820 KB |
Output is correct |
5 |
Correct |
321 ms |
9820 KB |
Output is correct |
6 |
Correct |
313 ms |
9816 KB |
Output is correct |
7 |
Correct |
149 ms |
9816 KB |
Output is correct |
8 |
Correct |
314 ms |
9820 KB |
Output is correct |
9 |
Correct |
373 ms |
9816 KB |
Output is correct |
10 |
Correct |
14 ms |
9844 KB |
Output is correct |
11 |
Correct |
15 ms |
9820 KB |
Output is correct |
12 |
Correct |
10 ms |
10068 KB |
Output is correct |
13 |
Correct |
10 ms |
9820 KB |
Output is correct |
14 |
Correct |
6 ms |
9680 KB |
Output is correct |
15 |
Correct |
25 ms |
9820 KB |
Output is correct |
16 |
Correct |
333 ms |
9820 KB |
Output is correct |
17 |
Correct |
338 ms |
9820 KB |
Output is correct |
18 |
Correct |
159 ms |
9816 KB |
Output is correct |
19 |
Correct |
338 ms |
10068 KB |
Output is correct |
20 |
Correct |
421 ms |
9820 KB |
Output is correct |
21 |
Correct |
16 ms |
9820 KB |
Output is correct |
22 |
Correct |
15 ms |
9852 KB |
Output is correct |
23 |
Correct |
741 ms |
9820 KB |
Output is correct |
24 |
Correct |
784 ms |
9820 KB |
Output is correct |
25 |
Correct |
315 ms |
9828 KB |
Output is correct |
26 |
Correct |
971 ms |
9816 KB |
Output is correct |
27 |
Correct |
941 ms |
10072 KB |
Output is correct |
28 |
Correct |
18 ms |
9820 KB |
Output is correct |
29 |
Correct |
22 ms |
9844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
9852 KB |
Output is correct |
2 |
Incorrect |
110 ms |
9824 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
9852 KB |
Output is correct |
2 |
Incorrect |
110 ms |
9824 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
9852 KB |
Output is correct |
2 |
Incorrect |
110 ms |
9824 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
9820 KB |
Output is correct |
2 |
Correct |
8 ms |
9820 KB |
Output is correct |
3 |
Correct |
5 ms |
9628 KB |
Output is correct |
4 |
Correct |
23 ms |
9820 KB |
Output is correct |
5 |
Correct |
321 ms |
9820 KB |
Output is correct |
6 |
Correct |
313 ms |
9816 KB |
Output is correct |
7 |
Correct |
149 ms |
9816 KB |
Output is correct |
8 |
Correct |
314 ms |
9820 KB |
Output is correct |
9 |
Correct |
373 ms |
9816 KB |
Output is correct |
10 |
Correct |
14 ms |
9844 KB |
Output is correct |
11 |
Correct |
15 ms |
9820 KB |
Output is correct |
12 |
Correct |
25 ms |
9852 KB |
Output is correct |
13 |
Incorrect |
110 ms |
9824 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
9852 KB |
Output is correct |
2 |
Incorrect |
110 ms |
9824 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
9820 KB |
Output is correct |
2 |
Correct |
8 ms |
9820 KB |
Output is correct |
3 |
Correct |
5 ms |
9628 KB |
Output is correct |
4 |
Correct |
23 ms |
9820 KB |
Output is correct |
5 |
Correct |
321 ms |
9820 KB |
Output is correct |
6 |
Correct |
313 ms |
9816 KB |
Output is correct |
7 |
Correct |
149 ms |
9816 KB |
Output is correct |
8 |
Correct |
314 ms |
9820 KB |
Output is correct |
9 |
Correct |
373 ms |
9816 KB |
Output is correct |
10 |
Correct |
14 ms |
9844 KB |
Output is correct |
11 |
Correct |
15 ms |
9820 KB |
Output is correct |
12 |
Correct |
10 ms |
10068 KB |
Output is correct |
13 |
Correct |
10 ms |
9820 KB |
Output is correct |
14 |
Correct |
6 ms |
9680 KB |
Output is correct |
15 |
Correct |
25 ms |
9820 KB |
Output is correct |
16 |
Correct |
333 ms |
9820 KB |
Output is correct |
17 |
Correct |
338 ms |
9820 KB |
Output is correct |
18 |
Correct |
159 ms |
9816 KB |
Output is correct |
19 |
Correct |
338 ms |
10068 KB |
Output is correct |
20 |
Correct |
421 ms |
9820 KB |
Output is correct |
21 |
Correct |
16 ms |
9820 KB |
Output is correct |
22 |
Correct |
15 ms |
9852 KB |
Output is correct |
23 |
Correct |
741 ms |
9820 KB |
Output is correct |
24 |
Correct |
784 ms |
9820 KB |
Output is correct |
25 |
Correct |
315 ms |
9828 KB |
Output is correct |
26 |
Correct |
971 ms |
9816 KB |
Output is correct |
27 |
Correct |
941 ms |
10072 KB |
Output is correct |
28 |
Correct |
18 ms |
9820 KB |
Output is correct |
29 |
Correct |
22 ms |
9844 KB |
Output is correct |
30 |
Correct |
25 ms |
9852 KB |
Output is correct |
31 |
Incorrect |
110 ms |
9824 KB |
Output isn't correct |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
9852 KB |
Output is correct |
2 |
Incorrect |
110 ms |
9824 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
9820 KB |
Output is correct |
2 |
Correct |
8 ms |
9820 KB |
Output is correct |
3 |
Correct |
5 ms |
9628 KB |
Output is correct |
4 |
Correct |
23 ms |
9820 KB |
Output is correct |
5 |
Correct |
321 ms |
9820 KB |
Output is correct |
6 |
Correct |
313 ms |
9816 KB |
Output is correct |
7 |
Correct |
149 ms |
9816 KB |
Output is correct |
8 |
Correct |
314 ms |
9820 KB |
Output is correct |
9 |
Correct |
373 ms |
9816 KB |
Output is correct |
10 |
Correct |
14 ms |
9844 KB |
Output is correct |
11 |
Correct |
15 ms |
9820 KB |
Output is correct |
12 |
Correct |
10 ms |
10068 KB |
Output is correct |
13 |
Correct |
10 ms |
9820 KB |
Output is correct |
14 |
Correct |
6 ms |
9680 KB |
Output is correct |
15 |
Correct |
25 ms |
9820 KB |
Output is correct |
16 |
Correct |
333 ms |
9820 KB |
Output is correct |
17 |
Correct |
338 ms |
9820 KB |
Output is correct |
18 |
Correct |
159 ms |
9816 KB |
Output is correct |
19 |
Correct |
338 ms |
10068 KB |
Output is correct |
20 |
Correct |
421 ms |
9820 KB |
Output is correct |
21 |
Correct |
16 ms |
9820 KB |
Output is correct |
22 |
Correct |
15 ms |
9852 KB |
Output is correct |
23 |
Correct |
741 ms |
9820 KB |
Output is correct |
24 |
Correct |
784 ms |
9820 KB |
Output is correct |
25 |
Correct |
315 ms |
9828 KB |
Output is correct |
26 |
Correct |
971 ms |
9816 KB |
Output is correct |
27 |
Correct |
941 ms |
10072 KB |
Output is correct |
28 |
Correct |
18 ms |
9820 KB |
Output is correct |
29 |
Correct |
22 ms |
9844 KB |
Output is correct |
30 |
Correct |
25 ms |
9852 KB |
Output is correct |
31 |
Incorrect |
110 ms |
9824 KB |
Output isn't correct |
32 |
Halted |
0 ms |
0 KB |
- |