Submission #849933

# Submission time Handle Problem Language Result Execution time Memory
849933 2023-09-15T14:54:17 Z Ahmed57 Uplifting Excursion (BOI22_vault) C++17
0 / 100
388 ms 160848 KB
#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001],arr[301],br = 5e4,n,m;
long long solve(int i,int xd){
    if(i==2*m+1){
        if(xd==n+br)return 0;
        else return -1e18;
    }
    if(dp[i][xd]!=-1)return dp[i][xd];
    long long ans = -1e18;
    for(int j = 0;j<=arr[i];j++){
        ans = max(ans,solve(i+1,xd+j*(i-m))+j);
    }
    return dp[i][xd] = ans;
}
signed main(){
    cin>>m>>n;
    for(int i = 0;i<2*m+1;i++){
        cin>>arr[i];
    }
    memset(dp,-1,sizeof dp);
    long long vl = solve(0,5e4);
    if(vl<0)cout<<"impossible\n";
    else cout<<vl<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 13 ms 79448 KB Output is correct
2 Correct 9 ms 79448 KB Output is correct
3 Correct 10 ms 79448 KB Output is correct
4 Correct 10 ms 79456 KB Output is correct
5 Correct 351 ms 79320 KB Output is correct
6 Correct 388 ms 79484 KB Output is correct
7 Correct 73 ms 79448 KB Output is correct
8 Correct 335 ms 79476 KB Output is correct
9 Runtime error 214 ms 160776 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 79448 KB Output is correct
2 Correct 9 ms 79448 KB Output is correct
3 Correct 10 ms 79448 KB Output is correct
4 Correct 10 ms 79456 KB Output is correct
5 Correct 351 ms 79320 KB Output is correct
6 Correct 388 ms 79484 KB Output is correct
7 Correct 73 ms 79448 KB Output is correct
8 Correct 335 ms 79476 KB Output is correct
9 Runtime error 214 ms 160776 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 79448 KB Output is correct
2 Runtime error 233 ms 160848 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 79448 KB Output is correct
2 Runtime error 233 ms 160848 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 79448 KB Output is correct
2 Runtime error 233 ms 160848 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 79448 KB Output is correct
2 Correct 9 ms 79448 KB Output is correct
3 Correct 10 ms 79448 KB Output is correct
4 Correct 10 ms 79456 KB Output is correct
5 Correct 351 ms 79320 KB Output is correct
6 Correct 388 ms 79484 KB Output is correct
7 Correct 73 ms 79448 KB Output is correct
8 Correct 335 ms 79476 KB Output is correct
9 Runtime error 214 ms 160776 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 79448 KB Output is correct
2 Runtime error 233 ms 160848 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 79448 KB Output is correct
2 Correct 9 ms 79448 KB Output is correct
3 Correct 10 ms 79448 KB Output is correct
4 Correct 10 ms 79456 KB Output is correct
5 Correct 351 ms 79320 KB Output is correct
6 Correct 388 ms 79484 KB Output is correct
7 Correct 73 ms 79448 KB Output is correct
8 Correct 335 ms 79476 KB Output is correct
9 Runtime error 214 ms 160776 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 79448 KB Output is correct
2 Runtime error 233 ms 160848 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 79448 KB Output is correct
2 Correct 9 ms 79448 KB Output is correct
3 Correct 10 ms 79448 KB Output is correct
4 Correct 10 ms 79456 KB Output is correct
5 Correct 351 ms 79320 KB Output is correct
6 Correct 388 ms 79484 KB Output is correct
7 Correct 73 ms 79448 KB Output is correct
8 Correct 335 ms 79476 KB Output is correct
9 Runtime error 214 ms 160776 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -