답안 #849986

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
849986 2023-09-15T15:19:34 Z Ahmed57 Uplifting Excursion (BOI22_vault) C++17
0 / 100
1434 ms 6796 KB
#include <bits/stdc++.h>
using namespace std;
int dp[2][505000*2+1],arr[301],br = 505000,n,m;

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    cin>>m>>n;
    for(int i = 0;i<2*m+1;i++){
        cin>>arr[i];
    }
    for(int i = 2*m+1;i>=0;i--){
        for(int j = 0;j<=min(i*2*100+505000,505000*2);j++){
            if(i==2*m+1){
                if(j==n+br){
                    dp[i&1][j] = 0;
                }else{
                    dp[i&1][j] = -1e9;
                }
                continue;
            }
            int ans = -1e9;
            for(int e = 0;e<=arr[i];e++){
                if(j+e*(i-m)>505000*2)break;
                if(j+e*(i-m)<0)continue;
                ans = max(ans,dp[!(i&1)][j+e*(i-m)]+e);
            }
            dp[i&1][j] = ans;
        }
    }
    long long vl = dp[0][505000];
    if(vl<0)cout<<"impossible\n";
    else cout<<vl<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 6796 KB Output is correct
2 Correct 9 ms 6748 KB Output is correct
3 Correct 6 ms 6748 KB Output is correct
4 Correct 53 ms 6744 KB Output is correct
5 Correct 66 ms 6748 KB Output is correct
6 Correct 1434 ms 6772 KB Output is correct
7 Correct 577 ms 6744 KB Output is correct
8 Incorrect 1345 ms 6776 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 6796 KB Output is correct
2 Correct 9 ms 6748 KB Output is correct
3 Correct 6 ms 6748 KB Output is correct
4 Correct 53 ms 6744 KB Output is correct
5 Correct 66 ms 6748 KB Output is correct
6 Correct 1434 ms 6772 KB Output is correct
7 Correct 577 ms 6744 KB Output is correct
8 Incorrect 1345 ms 6776 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 6748 KB Output is correct
2 Incorrect 41 ms 6772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 6748 KB Output is correct
2 Incorrect 41 ms 6772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 6748 KB Output is correct
2 Incorrect 41 ms 6772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 6796 KB Output is correct
2 Correct 9 ms 6748 KB Output is correct
3 Correct 6 ms 6748 KB Output is correct
4 Correct 53 ms 6744 KB Output is correct
5 Correct 66 ms 6748 KB Output is correct
6 Correct 1434 ms 6772 KB Output is correct
7 Correct 577 ms 6744 KB Output is correct
8 Incorrect 1345 ms 6776 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 6748 KB Output is correct
2 Incorrect 41 ms 6772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 6796 KB Output is correct
2 Correct 9 ms 6748 KB Output is correct
3 Correct 6 ms 6748 KB Output is correct
4 Correct 53 ms 6744 KB Output is correct
5 Correct 66 ms 6748 KB Output is correct
6 Correct 1434 ms 6772 KB Output is correct
7 Correct 577 ms 6744 KB Output is correct
8 Incorrect 1345 ms 6776 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 6748 KB Output is correct
2 Incorrect 41 ms 6772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 6796 KB Output is correct
2 Correct 9 ms 6748 KB Output is correct
3 Correct 6 ms 6748 KB Output is correct
4 Correct 53 ms 6744 KB Output is correct
5 Correct 66 ms 6748 KB Output is correct
6 Correct 1434 ms 6772 KB Output is correct
7 Correct 577 ms 6744 KB Output is correct
8 Incorrect 1345 ms 6776 KB Output isn't correct
9 Halted 0 ms 0 KB -