Submission #580394

# Submission time Handle Problem Language Result Execution time Memory
580394 2022-06-21T07:47:08 Z 조영욱(#8357) Uplifting Excursion (BOI22_vault) C++17
5 / 100
1971 ms 120088 KB
#include <bits/stdc++.h>
using namespace std;

int m;
long long l;
int dp[102][300001];
const int zero=150000;
int arr[102];

int main(void) {
    scanf("%d %lld",&m,&l);
    if (l>zero||l<-zero) {
        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<=2*m+1;j++)
        dp[j][i]=-9e5;
    }
    dp[0][zero]=0;
    for(int i=1;i<=m*2+1;i++) {
        for(int j=0;j<=zero*2;j++) {
            for(int k=0;k<=arr[i];k++) {
                int val=j+k*(i-m-1);
                if (val>=0&&val<=zero*2) {
                    dp[i][val]=max(dp[i][val],dp[i-1][j]+k);
                }
            }
        }
    }
    if (dp[2*m+1][zero+l]<0) {
        printf("impossible");
        return 0;
    }
    printf("%d",dp[2*m+1][zero+l]);
}

Compilation message

vault.cpp: In function 'int main()':
vault.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d %lld",&m,&l);
      |     ~~~~~^~~~~~~~~~~~~~~~~
vault.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%d",&arr[i]);
      |         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 11 ms 7252 KB Output is correct
2 Correct 12 ms 9700 KB Output is correct
3 Correct 7 ms 5000 KB Output is correct
4 Correct 61 ms 26112 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1210 ms 120044 KB Output is correct
7 Correct 529 ms 120040 KB Output is correct
8 Correct 1083 ms 120044 KB Output is correct
9 Correct 1957 ms 120044 KB Output is correct
10 Correct 162 ms 120048 KB Output is correct
11 Correct 173 ms 120044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 7252 KB Output is correct
2 Correct 12 ms 9700 KB Output is correct
3 Correct 7 ms 5000 KB Output is correct
4 Correct 61 ms 26112 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1210 ms 120044 KB Output is correct
7 Correct 529 ms 120040 KB Output is correct
8 Correct 1083 ms 120044 KB Output is correct
9 Correct 1957 ms 120044 KB Output is correct
10 Correct 162 ms 120048 KB Output is correct
11 Correct 173 ms 120044 KB Output is correct
12 Correct 12 ms 7352 KB Output is correct
13 Correct 13 ms 9684 KB Output is correct
14 Correct 9 ms 5004 KB Output is correct
15 Correct 45 ms 26108 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1190 ms 120088 KB Output is correct
18 Correct 542 ms 120044 KB Output is correct
19 Correct 1113 ms 120044 KB Output is correct
20 Correct 1971 ms 120044 KB Output is correct
21 Correct 168 ms 120012 KB Output is correct
22 Correct 164 ms 120044 KB Output is correct
23 Correct 1 ms 228 KB Output is correct
24 Runtime error 7 ms 1512 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 55 ms 26148 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 55 ms 26148 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 55 ms 26148 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 7252 KB Output is correct
2 Correct 12 ms 9700 KB Output is correct
3 Correct 7 ms 5000 KB Output is correct
4 Correct 61 ms 26112 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1210 ms 120044 KB Output is correct
7 Correct 529 ms 120040 KB Output is correct
8 Correct 1083 ms 120044 KB Output is correct
9 Correct 1957 ms 120044 KB Output is correct
10 Correct 162 ms 120048 KB Output is correct
11 Correct 173 ms 120044 KB Output is correct
12 Correct 55 ms 26148 KB Output is correct
13 Incorrect 0 ms 212 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 55 ms 26148 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 7252 KB Output is correct
2 Correct 12 ms 9700 KB Output is correct
3 Correct 7 ms 5000 KB Output is correct
4 Correct 61 ms 26112 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1210 ms 120044 KB Output is correct
7 Correct 529 ms 120040 KB Output is correct
8 Correct 1083 ms 120044 KB Output is correct
9 Correct 1957 ms 120044 KB Output is correct
10 Correct 162 ms 120048 KB Output is correct
11 Correct 173 ms 120044 KB Output is correct
12 Correct 12 ms 7352 KB Output is correct
13 Correct 13 ms 9684 KB Output is correct
14 Correct 9 ms 5004 KB Output is correct
15 Correct 45 ms 26108 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1190 ms 120088 KB Output is correct
18 Correct 542 ms 120044 KB Output is correct
19 Correct 1113 ms 120044 KB Output is correct
20 Correct 1971 ms 120044 KB Output is correct
21 Correct 168 ms 120012 KB Output is correct
22 Correct 164 ms 120044 KB Output is correct
23 Correct 1 ms 228 KB Output is correct
24 Runtime error 7 ms 1512 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 55 ms 26148 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 7252 KB Output is correct
2 Correct 12 ms 9700 KB Output is correct
3 Correct 7 ms 5000 KB Output is correct
4 Correct 61 ms 26112 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1210 ms 120044 KB Output is correct
7 Correct 529 ms 120040 KB Output is correct
8 Correct 1083 ms 120044 KB Output is correct
9 Correct 1957 ms 120044 KB Output is correct
10 Correct 162 ms 120048 KB Output is correct
11 Correct 173 ms 120044 KB Output is correct
12 Correct 12 ms 7352 KB Output is correct
13 Correct 13 ms 9684 KB Output is correct
14 Correct 9 ms 5004 KB Output is correct
15 Correct 45 ms 26108 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1190 ms 120088 KB Output is correct
18 Correct 542 ms 120044 KB Output is correct
19 Correct 1113 ms 120044 KB Output is correct
20 Correct 1971 ms 120044 KB Output is correct
21 Correct 168 ms 120012 KB Output is correct
22 Correct 164 ms 120044 KB Output is correct
23 Correct 1 ms 228 KB Output is correct
24 Runtime error 7 ms 1512 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -