Submission #1019619

# Submission time Handle Problem Language Result Execution time Memory
1019619 2024-07-11T05:19:17 Z 변재우(#10911) Uplifting Excursion (BOI22_vault) C++17
5 / 100
934 ms 9852 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>=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 11 ms 9820 KB Output is correct
3 Correct 6 ms 9820 KB Output is correct
4 Correct 25 ms 9816 KB Output is correct
5 Correct 340 ms 9820 KB Output is correct
6 Correct 362 ms 9820 KB Output is correct
7 Correct 146 ms 9816 KB Output is correct
8 Correct 364 ms 9816 KB Output is correct
9 Correct 418 ms 9820 KB Output is correct
10 Correct 16 ms 9816 KB Output is correct
11 Correct 16 ms 9848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 9820 KB Output is correct
2 Correct 11 ms 9820 KB Output is correct
3 Correct 6 ms 9820 KB Output is correct
4 Correct 25 ms 9816 KB Output is correct
5 Correct 340 ms 9820 KB Output is correct
6 Correct 362 ms 9820 KB Output is correct
7 Correct 146 ms 9816 KB Output is correct
8 Correct 364 ms 9816 KB Output is correct
9 Correct 418 ms 9820 KB Output is correct
10 Correct 16 ms 9816 KB Output is correct
11 Correct 16 ms 9848 KB Output is correct
12 Correct 11 ms 9820 KB Output is correct
13 Correct 9 ms 9820 KB Output is correct
14 Correct 7 ms 9820 KB Output is correct
15 Correct 27 ms 9848 KB Output is correct
16 Correct 346 ms 9828 KB Output is correct
17 Correct 361 ms 9820 KB Output is correct
18 Correct 148 ms 9816 KB Output is correct
19 Correct 343 ms 9816 KB Output is correct
20 Correct 419 ms 9824 KB Output is correct
21 Correct 16 ms 9816 KB Output is correct
22 Correct 16 ms 9852 KB Output is correct
23 Correct 771 ms 9832 KB Output is correct
24 Correct 763 ms 9832 KB Output is correct
25 Correct 309 ms 9820 KB Output is correct
26 Incorrect 934 ms 9824 KB Output isn't correct
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 9820 KB Output is correct
2 Incorrect 112 ms 9816 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 112 ms 9816 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 112 ms 9816 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 11 ms 9820 KB Output is correct
3 Correct 6 ms 9820 KB Output is correct
4 Correct 25 ms 9816 KB Output is correct
5 Correct 340 ms 9820 KB Output is correct
6 Correct 362 ms 9820 KB Output is correct
7 Correct 146 ms 9816 KB Output is correct
8 Correct 364 ms 9816 KB Output is correct
9 Correct 418 ms 9820 KB Output is correct
10 Correct 16 ms 9816 KB Output is correct
11 Correct 16 ms 9848 KB Output is correct
12 Correct 25 ms 9820 KB Output is correct
13 Incorrect 112 ms 9816 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 112 ms 9816 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 11 ms 9820 KB Output is correct
3 Correct 6 ms 9820 KB Output is correct
4 Correct 25 ms 9816 KB Output is correct
5 Correct 340 ms 9820 KB Output is correct
6 Correct 362 ms 9820 KB Output is correct
7 Correct 146 ms 9816 KB Output is correct
8 Correct 364 ms 9816 KB Output is correct
9 Correct 418 ms 9820 KB Output is correct
10 Correct 16 ms 9816 KB Output is correct
11 Correct 16 ms 9848 KB Output is correct
12 Correct 11 ms 9820 KB Output is correct
13 Correct 9 ms 9820 KB Output is correct
14 Correct 7 ms 9820 KB Output is correct
15 Correct 27 ms 9848 KB Output is correct
16 Correct 346 ms 9828 KB Output is correct
17 Correct 361 ms 9820 KB Output is correct
18 Correct 148 ms 9816 KB Output is correct
19 Correct 343 ms 9816 KB Output is correct
20 Correct 419 ms 9824 KB Output is correct
21 Correct 16 ms 9816 KB Output is correct
22 Correct 16 ms 9852 KB Output is correct
23 Correct 771 ms 9832 KB Output is correct
24 Correct 763 ms 9832 KB Output is correct
25 Correct 309 ms 9820 KB Output is correct
26 Incorrect 934 ms 9824 KB Output isn't correct
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 9820 KB Output is correct
2 Incorrect 112 ms 9816 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 11 ms 9820 KB Output is correct
3 Correct 6 ms 9820 KB Output is correct
4 Correct 25 ms 9816 KB Output is correct
5 Correct 340 ms 9820 KB Output is correct
6 Correct 362 ms 9820 KB Output is correct
7 Correct 146 ms 9816 KB Output is correct
8 Correct 364 ms 9816 KB Output is correct
9 Correct 418 ms 9820 KB Output is correct
10 Correct 16 ms 9816 KB Output is correct
11 Correct 16 ms 9848 KB Output is correct
12 Correct 11 ms 9820 KB Output is correct
13 Correct 9 ms 9820 KB Output is correct
14 Correct 7 ms 9820 KB Output is correct
15 Correct 27 ms 9848 KB Output is correct
16 Correct 346 ms 9828 KB Output is correct
17 Correct 361 ms 9820 KB Output is correct
18 Correct 148 ms 9816 KB Output is correct
19 Correct 343 ms 9816 KB Output is correct
20 Correct 419 ms 9824 KB Output is correct
21 Correct 16 ms 9816 KB Output is correct
22 Correct 16 ms 9852 KB Output is correct
23 Correct 771 ms 9832 KB Output is correct
24 Correct 763 ms 9832 KB Output is correct
25 Correct 309 ms 9820 KB Output is correct
26 Incorrect 934 ms 9824 KB Output isn't correct
27 Halted 0 ms 0 KB -