# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1019617 |
2024-07-11T05:18:13 Z |
변재우(#10911) |
Uplifting Excursion (BOI22_vault) |
C++17 |
|
409 ms |
19568 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; 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>=t; j--) D[j]=max(D[j], D[j-i*t]+t);
else for(int j=0; j<=1200000; 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 |
11 ms |
9820 KB |
Output is correct |
2 |
Correct |
9 ms |
9860 KB |
Output is correct |
3 |
Correct |
7 ms |
9820 KB |
Output is correct |
4 |
Correct |
26 ms |
9676 KB |
Output is correct |
5 |
Correct |
369 ms |
10068 KB |
Output is correct |
6 |
Correct |
328 ms |
9820 KB |
Output is correct |
7 |
Correct |
158 ms |
9816 KB |
Output is correct |
8 |
Correct |
338 ms |
9820 KB |
Output is correct |
9 |
Correct |
409 ms |
9816 KB |
Output is correct |
10 |
Correct |
17 ms |
9820 KB |
Output is correct |
11 |
Correct |
16 ms |
9852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
9820 KB |
Output is correct |
2 |
Correct |
9 ms |
9860 KB |
Output is correct |
3 |
Correct |
7 ms |
9820 KB |
Output is correct |
4 |
Correct |
26 ms |
9676 KB |
Output is correct |
5 |
Correct |
369 ms |
10068 KB |
Output is correct |
6 |
Correct |
328 ms |
9820 KB |
Output is correct |
7 |
Correct |
158 ms |
9816 KB |
Output is correct |
8 |
Correct |
338 ms |
9820 KB |
Output is correct |
9 |
Correct |
409 ms |
9816 KB |
Output is correct |
10 |
Correct |
17 ms |
9820 KB |
Output is correct |
11 |
Correct |
16 ms |
9852 KB |
Output is correct |
12 |
Correct |
11 ms |
9816 KB |
Output is correct |
13 |
Correct |
11 ms |
9740 KB |
Output is correct |
14 |
Correct |
6 ms |
9604 KB |
Output is correct |
15 |
Correct |
27 ms |
9820 KB |
Output is correct |
16 |
Correct |
353 ms |
9820 KB |
Output is correct |
17 |
Correct |
362 ms |
9824 KB |
Output is correct |
18 |
Correct |
134 ms |
9820 KB |
Output is correct |
19 |
Correct |
364 ms |
10068 KB |
Output is correct |
20 |
Correct |
404 ms |
9816 KB |
Output is correct |
21 |
Correct |
17 ms |
9820 KB |
Output is correct |
22 |
Correct |
17 ms |
9820 KB |
Output is correct |
23 |
Runtime error |
24 ms |
19568 KB |
Execution killed with signal 11 |
24 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
9820 KB |
Output is correct |
2 |
Incorrect |
113 ms |
9820 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
9820 KB |
Output is correct |
2 |
Incorrect |
113 ms |
9820 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
9820 KB |
Output is correct |
2 |
Incorrect |
113 ms |
9820 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
9820 KB |
Output is correct |
2 |
Correct |
9 ms |
9860 KB |
Output is correct |
3 |
Correct |
7 ms |
9820 KB |
Output is correct |
4 |
Correct |
26 ms |
9676 KB |
Output is correct |
5 |
Correct |
369 ms |
10068 KB |
Output is correct |
6 |
Correct |
328 ms |
9820 KB |
Output is correct |
7 |
Correct |
158 ms |
9816 KB |
Output is correct |
8 |
Correct |
338 ms |
9820 KB |
Output is correct |
9 |
Correct |
409 ms |
9816 KB |
Output is correct |
10 |
Correct |
17 ms |
9820 KB |
Output is correct |
11 |
Correct |
16 ms |
9852 KB |
Output is correct |
12 |
Correct |
25 ms |
9820 KB |
Output is correct |
13 |
Incorrect |
113 ms |
9820 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
9820 KB |
Output is correct |
2 |
Incorrect |
113 ms |
9820 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
9820 KB |
Output is correct |
2 |
Correct |
9 ms |
9860 KB |
Output is correct |
3 |
Correct |
7 ms |
9820 KB |
Output is correct |
4 |
Correct |
26 ms |
9676 KB |
Output is correct |
5 |
Correct |
369 ms |
10068 KB |
Output is correct |
6 |
Correct |
328 ms |
9820 KB |
Output is correct |
7 |
Correct |
158 ms |
9816 KB |
Output is correct |
8 |
Correct |
338 ms |
9820 KB |
Output is correct |
9 |
Correct |
409 ms |
9816 KB |
Output is correct |
10 |
Correct |
17 ms |
9820 KB |
Output is correct |
11 |
Correct |
16 ms |
9852 KB |
Output is correct |
12 |
Correct |
11 ms |
9816 KB |
Output is correct |
13 |
Correct |
11 ms |
9740 KB |
Output is correct |
14 |
Correct |
6 ms |
9604 KB |
Output is correct |
15 |
Correct |
27 ms |
9820 KB |
Output is correct |
16 |
Correct |
353 ms |
9820 KB |
Output is correct |
17 |
Correct |
362 ms |
9824 KB |
Output is correct |
18 |
Correct |
134 ms |
9820 KB |
Output is correct |
19 |
Correct |
364 ms |
10068 KB |
Output is correct |
20 |
Correct |
404 ms |
9816 KB |
Output is correct |
21 |
Correct |
17 ms |
9820 KB |
Output is correct |
22 |
Correct |
17 ms |
9820 KB |
Output is correct |
23 |
Runtime error |
24 ms |
19568 KB |
Execution killed with signal 11 |
24 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
9820 KB |
Output is correct |
2 |
Incorrect |
113 ms |
9820 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
9820 KB |
Output is correct |
2 |
Correct |
9 ms |
9860 KB |
Output is correct |
3 |
Correct |
7 ms |
9820 KB |
Output is correct |
4 |
Correct |
26 ms |
9676 KB |
Output is correct |
5 |
Correct |
369 ms |
10068 KB |
Output is correct |
6 |
Correct |
328 ms |
9820 KB |
Output is correct |
7 |
Correct |
158 ms |
9816 KB |
Output is correct |
8 |
Correct |
338 ms |
9820 KB |
Output is correct |
9 |
Correct |
409 ms |
9816 KB |
Output is correct |
10 |
Correct |
17 ms |
9820 KB |
Output is correct |
11 |
Correct |
16 ms |
9852 KB |
Output is correct |
12 |
Correct |
11 ms |
9816 KB |
Output is correct |
13 |
Correct |
11 ms |
9740 KB |
Output is correct |
14 |
Correct |
6 ms |
9604 KB |
Output is correct |
15 |
Correct |
27 ms |
9820 KB |
Output is correct |
16 |
Correct |
353 ms |
9820 KB |
Output is correct |
17 |
Correct |
362 ms |
9824 KB |
Output is correct |
18 |
Correct |
134 ms |
9820 KB |
Output is correct |
19 |
Correct |
364 ms |
10068 KB |
Output is correct |
20 |
Correct |
404 ms |
9816 KB |
Output is correct |
21 |
Correct |
17 ms |
9820 KB |
Output is correct |
22 |
Correct |
17 ms |
9820 KB |
Output is correct |
23 |
Runtime error |
24 ms |
19568 KB |
Execution killed with signal 11 |
24 |
Halted |
0 ms |
0 KB |
- |