Submission #849941

# Submission time Handle Problem Language Result Execution time Memory
849941 2023-09-15T14:58:24 Z Ahmed57 Uplifting Excursion (BOI22_vault) C++17
5 / 100
3990 ms 32084 KB
#include <bits/stdc++.h>
using namespace std;
long long dp[2][1000001],arr[301],br = 5e5,n,m;

signed main(){
    cin>>m>>n;
    for(int i = 0;i<2*m+1;i++){
        cin>>arr[i];
    }
    memset(dp,-1,sizeof dp);
    for(int i = 2*m+1;i>=0;i--){
        for(int j = 0;j<=1e6;j++){
            if(i==2*m+1){
                if(j==n+br){
                    dp[i&1][j] = 0;
                }else{
                    dp[i&1][j] = -1e18;
                }
                continue;
            }
            long long ans = -1e18;
            for(int e = 0;e<=arr[i];e++){
                ans = max(ans,dp[!(i&1)][j+e*(i-m)]+e);
            }
            dp[i&1][j] = ans;
        }
    }
    long long vl = dp[0][500000];
    if(vl<0)cout<<"impossible\n";
    else cout<<vl<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 17 ms 15960 KB Output is correct
2 Correct 18 ms 15960 KB Output is correct
3 Correct 11 ms 15964 KB Output is correct
4 Correct 75 ms 15964 KB Output is correct
5 Correct 2112 ms 16068 KB Output is correct
6 Correct 2248 ms 16068 KB Output is correct
7 Correct 1000 ms 16064 KB Output is correct
8 Correct 2109 ms 16064 KB Output is correct
9 Correct 3990 ms 16064 KB Output is correct
10 Correct 230 ms 16220 KB Output is correct
11 Correct 197 ms 16068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 15960 KB Output is correct
2 Correct 18 ms 15960 KB Output is correct
3 Correct 11 ms 15964 KB Output is correct
4 Correct 75 ms 15964 KB Output is correct
5 Correct 2112 ms 16068 KB Output is correct
6 Correct 2248 ms 16068 KB Output is correct
7 Correct 1000 ms 16064 KB Output is correct
8 Correct 2109 ms 16064 KB Output is correct
9 Correct 3990 ms 16064 KB Output is correct
10 Correct 230 ms 16220 KB Output is correct
11 Correct 197 ms 16068 KB Output is correct
12 Correct 17 ms 16164 KB Output is correct
13 Correct 18 ms 15964 KB Output is correct
14 Correct 13 ms 15964 KB Output is correct
15 Correct 79 ms 16072 KB Output is correct
16 Correct 2092 ms 16072 KB Output is correct
17 Correct 2247 ms 16068 KB Output is correct
18 Correct 944 ms 16068 KB Output is correct
19 Correct 2192 ms 16072 KB Output is correct
20 Correct 3949 ms 16072 KB Output is correct
21 Correct 260 ms 15964 KB Output is correct
22 Correct 203 ms 15964 KB Output is correct
23 Runtime error 41 ms 32084 KB Execution killed with signal 11
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 77 ms 16072 KB Output is correct
2 Runtime error 66 ms 32084 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 77 ms 16072 KB Output is correct
2 Runtime error 66 ms 32084 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 77 ms 16072 KB Output is correct
2 Runtime error 66 ms 32084 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 15960 KB Output is correct
2 Correct 18 ms 15960 KB Output is correct
3 Correct 11 ms 15964 KB Output is correct
4 Correct 75 ms 15964 KB Output is correct
5 Correct 2112 ms 16068 KB Output is correct
6 Correct 2248 ms 16068 KB Output is correct
7 Correct 1000 ms 16064 KB Output is correct
8 Correct 2109 ms 16064 KB Output is correct
9 Correct 3990 ms 16064 KB Output is correct
10 Correct 230 ms 16220 KB Output is correct
11 Correct 197 ms 16068 KB Output is correct
12 Correct 77 ms 16072 KB Output is correct
13 Runtime error 66 ms 32084 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 77 ms 16072 KB Output is correct
2 Runtime error 66 ms 32084 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 15960 KB Output is correct
2 Correct 18 ms 15960 KB Output is correct
3 Correct 11 ms 15964 KB Output is correct
4 Correct 75 ms 15964 KB Output is correct
5 Correct 2112 ms 16068 KB Output is correct
6 Correct 2248 ms 16068 KB Output is correct
7 Correct 1000 ms 16064 KB Output is correct
8 Correct 2109 ms 16064 KB Output is correct
9 Correct 3990 ms 16064 KB Output is correct
10 Correct 230 ms 16220 KB Output is correct
11 Correct 197 ms 16068 KB Output is correct
12 Correct 17 ms 16164 KB Output is correct
13 Correct 18 ms 15964 KB Output is correct
14 Correct 13 ms 15964 KB Output is correct
15 Correct 79 ms 16072 KB Output is correct
16 Correct 2092 ms 16072 KB Output is correct
17 Correct 2247 ms 16068 KB Output is correct
18 Correct 944 ms 16068 KB Output is correct
19 Correct 2192 ms 16072 KB Output is correct
20 Correct 3949 ms 16072 KB Output is correct
21 Correct 260 ms 15964 KB Output is correct
22 Correct 203 ms 15964 KB Output is correct
23 Runtime error 41 ms 32084 KB Execution killed with signal 11
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 77 ms 16072 KB Output is correct
2 Runtime error 66 ms 32084 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 15960 KB Output is correct
2 Correct 18 ms 15960 KB Output is correct
3 Correct 11 ms 15964 KB Output is correct
4 Correct 75 ms 15964 KB Output is correct
5 Correct 2112 ms 16068 KB Output is correct
6 Correct 2248 ms 16068 KB Output is correct
7 Correct 1000 ms 16064 KB Output is correct
8 Correct 2109 ms 16064 KB Output is correct
9 Correct 3990 ms 16064 KB Output is correct
10 Correct 230 ms 16220 KB Output is correct
11 Correct 197 ms 16068 KB Output is correct
12 Correct 17 ms 16164 KB Output is correct
13 Correct 18 ms 15964 KB Output is correct
14 Correct 13 ms 15964 KB Output is correct
15 Correct 79 ms 16072 KB Output is correct
16 Correct 2092 ms 16072 KB Output is correct
17 Correct 2247 ms 16068 KB Output is correct
18 Correct 944 ms 16068 KB Output is correct
19 Correct 2192 ms 16072 KB Output is correct
20 Correct 3949 ms 16072 KB Output is correct
21 Correct 260 ms 15964 KB Output is correct
22 Correct 203 ms 15964 KB Output is correct
23 Runtime error 41 ms 32084 KB Execution killed with signal 11
24 Halted 0 ms 0 KB -