Submission #850016

# Submission time Handle Problem Language Result Execution time Memory
850016 2023-09-15T15:46:20 Z Ahmed57 Uplifting Excursion (BOI22_vault) C++17
0 / 100
165 ms 16528 KB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
int dp[2][505000*2+1],arr[301];
int br = 505000,n,m;

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    cin>>m>>n;
    for(int i = 1;i<=2*m+1;i++){
        cin>>arr[i];
    }
    for(int i = 0;i<=505000*2;i++){
        dp[0][i] = -3e4;
        if(i==505000)dp[0][i] = 0;
    }
    for(int i = 1;i<=2*m+1;i++){
        for(int j = 0;j<=(505000*2);j++){
            int ans = -3e4;
            for(int e = 0;e<=arr[i];e++){
                if(j-e*(i-1-m)>505000*2)continue;
                if(j-e*(i-1-m)<0)continue;
                ans = max(ans,dp[!(i&1)][j-e*((i-1)-m)]+e);
            }
            dp[i&1][j] = ans;
        }
    }
    long long vl = dp[(2*m+1)&1][n+505000];
    if(vl<0)cout<<"impossible\n";
    else cout<<vl<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 18 ms 8280 KB Output is correct
2 Correct 19 ms 8284 KB Output is correct
3 Correct 12 ms 8284 KB Output is correct
4 Correct 85 ms 8284 KB Output is correct
5 Runtime error 165 ms 16464 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 8280 KB Output is correct
2 Correct 19 ms 8284 KB Output is correct
3 Correct 12 ms 8284 KB Output is correct
4 Correct 85 ms 8284 KB Output is correct
5 Runtime error 165 ms 16464 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 85 ms 8280 KB Output is correct
2 Runtime error 106 ms 16528 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 85 ms 8280 KB Output is correct
2 Runtime error 106 ms 16528 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 85 ms 8280 KB Output is correct
2 Runtime error 106 ms 16528 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 8280 KB Output is correct
2 Correct 19 ms 8284 KB Output is correct
3 Correct 12 ms 8284 KB Output is correct
4 Correct 85 ms 8284 KB Output is correct
5 Runtime error 165 ms 16464 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 85 ms 8280 KB Output is correct
2 Runtime error 106 ms 16528 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 8280 KB Output is correct
2 Correct 19 ms 8284 KB Output is correct
3 Correct 12 ms 8284 KB Output is correct
4 Correct 85 ms 8284 KB Output is correct
5 Runtime error 165 ms 16464 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 85 ms 8280 KB Output is correct
2 Runtime error 106 ms 16528 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 8280 KB Output is correct
2 Correct 19 ms 8284 KB Output is correct
3 Correct 12 ms 8284 KB Output is correct
4 Correct 85 ms 8284 KB Output is correct
5 Runtime error 165 ms 16464 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -