답안 #849972

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

signed main(){
    cin>>m>>n;
    for(int i = 0;i<2*m+1;i++){
        cin>>arr[i];
    }
    int vl = -30001;
    for(int i = 2*m+1;i>=0;i--){
        for(int j = 0;j<=2e6;j++){
            if(i==2*m+1){
                if(j==n+br){
                    dp[i&1][j] = 0;
                }else{
                    dp[i&1][j] = vl;
                }
                continue;
            }
            int ans = vl;
            for(int e = 0;e<=arr[i];e++){
                if(j+e*(i-m)<0||j+e*(i-m)>2e6)continue;
                ans = max(ans,dp[!(i&1)][j+e*(i-m)]+e);
            }
            dp[i&1][j] = ans;
        }
    }
    long long vll = dp[0][1000000];
    if(vll<0)cout<<"impossible\n";
    else cout<<vll<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 8276 KB Output is correct
2 Correct 41 ms 8024 KB Output is correct
3 Correct 24 ms 8028 KB Output is correct
4 Correct 190 ms 8236 KB Output is correct
5 Correct 369 ms 8236 KB Output is correct
6 Execution timed out 5022 ms 8024 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 8276 KB Output is correct
2 Correct 41 ms 8024 KB Output is correct
3 Correct 24 ms 8028 KB Output is correct
4 Correct 190 ms 8236 KB Output is correct
5 Correct 369 ms 8236 KB Output is correct
6 Execution timed out 5022 ms 8024 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 8028 KB Output is correct
2 Incorrect 212 ms 8028 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 8028 KB Output is correct
2 Incorrect 212 ms 8028 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 8028 KB Output is correct
2 Incorrect 212 ms 8028 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 8276 KB Output is correct
2 Correct 41 ms 8024 KB Output is correct
3 Correct 24 ms 8028 KB Output is correct
4 Correct 190 ms 8236 KB Output is correct
5 Correct 369 ms 8236 KB Output is correct
6 Execution timed out 5022 ms 8024 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 8028 KB Output is correct
2 Incorrect 212 ms 8028 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 8276 KB Output is correct
2 Correct 41 ms 8024 KB Output is correct
3 Correct 24 ms 8028 KB Output is correct
4 Correct 190 ms 8236 KB Output is correct
5 Correct 369 ms 8236 KB Output is correct
6 Execution timed out 5022 ms 8024 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 8028 KB Output is correct
2 Incorrect 212 ms 8028 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 8276 KB Output is correct
2 Correct 41 ms 8024 KB Output is correct
3 Correct 24 ms 8028 KB Output is correct
4 Correct 190 ms 8236 KB Output is correct
5 Correct 369 ms 8236 KB Output is correct
6 Execution timed out 5022 ms 8024 KB Time limit exceeded
7 Halted 0 ms 0 KB -