# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
580376 | 2022-06-21T07:29:42 Z | 조영욱(#8357) | Uplifting Excursion (BOI22_vault) | C++17 | 760 ms | 40208 KB |
#include <bits/stdc++.h> using namespace std; int m; long long l; int dp[102][100001]; const int zero=50000; int arr[102]; int main(void) { scanf("%d %lld",&m,&l); if (l>50000||l<-50000) { printf("impossible"); return 0; } for(int i=1;i<=m*2+1;i++) { scanf("%d",&arr[i]); } for(int i=0;i<=zero*2;i++) { for(int j=0;j<=101;j++) dp[j][i]=-1e5; } dp[0][zero]=0; for(int i=1;i<=m*2+1;i++) { for(int j=0;j<=100000;j++) { for(int k=0;k<=arr[i];k++) { int val=j-k*(i-m-1); if (val>=0&&val<=zero*2) { dp[i][j]=max(dp[i][j],dp[i-1][val]+k); } } } } if (dp[2*m+1][zero+l]<0) { printf("impossible"); return 0; } printf("%d",dp[2*m+1][zero+l]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 40148 KB | Output is correct |
2 | Correct | 26 ms | 40108 KB | Output is correct |
3 | Correct | 26 ms | 40112 KB | Output is correct |
4 | Correct | 36 ms | 40160 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 760 ms | 40196 KB | Output is correct |
7 | Correct | 310 ms | 40200 KB | Output is correct |
8 | Correct | 684 ms | 40200 KB | Output is correct |
9 | Incorrect | 0 ms | 212 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 40148 KB | Output is correct |
2 | Correct | 26 ms | 40108 KB | Output is correct |
3 | Correct | 26 ms | 40112 KB | Output is correct |
4 | Correct | 36 ms | 40160 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 760 ms | 40196 KB | Output is correct |
7 | Correct | 310 ms | 40200 KB | Output is correct |
8 | Correct | 684 ms | 40200 KB | Output is correct |
9 | Incorrect | 0 ms | 212 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 40208 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 40208 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 40208 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 40148 KB | Output is correct |
2 | Correct | 26 ms | 40108 KB | Output is correct |
3 | Correct | 26 ms | 40112 KB | Output is correct |
4 | Correct | 36 ms | 40160 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 760 ms | 40196 KB | Output is correct |
7 | Correct | 310 ms | 40200 KB | Output is correct |
8 | Correct | 684 ms | 40200 KB | Output is correct |
9 | Incorrect | 0 ms | 212 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 40208 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 40148 KB | Output is correct |
2 | Correct | 26 ms | 40108 KB | Output is correct |
3 | Correct | 26 ms | 40112 KB | Output is correct |
4 | Correct | 36 ms | 40160 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 760 ms | 40196 KB | Output is correct |
7 | Correct | 310 ms | 40200 KB | Output is correct |
8 | Correct | 684 ms | 40200 KB | Output is correct |
9 | Incorrect | 0 ms | 212 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 40208 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 40148 KB | Output is correct |
2 | Correct | 26 ms | 40108 KB | Output is correct |
3 | Correct | 26 ms | 40112 KB | Output is correct |
4 | Correct | 36 ms | 40160 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 760 ms | 40196 KB | Output is correct |
7 | Correct | 310 ms | 40200 KB | Output is correct |
8 | Correct | 684 ms | 40200 KB | Output is correct |
9 | Incorrect | 0 ms | 212 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |