Submission #580370

# Submission time Handle Problem Language Result Execution time Memory
580370 2022-06-21T07:20:42 Z 조영욱(#8357) Uplifting Excursion (BOI22_vault) C++17
0 / 100
803 ms 81288 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);
    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);
                }
            }
        }
    }
    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:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%d",&arr[i]);
      |         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 24 ms 40148 KB Output is correct
2 Incorrect 25 ms 40148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 40148 KB Output is correct
2 Incorrect 25 ms 40148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 40212 KB Output is correct
2 Runtime error 803 ms 81288 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 40212 KB Output is correct
2 Runtime error 803 ms 81288 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 40212 KB Output is correct
2 Runtime error 803 ms 81288 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 40148 KB Output is correct
2 Incorrect 25 ms 40148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 40212 KB Output is correct
2 Runtime error 803 ms 81288 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 40148 KB Output is correct
2 Incorrect 25 ms 40148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 40212 KB Output is correct
2 Runtime error 803 ms 81288 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 40148 KB Output is correct
2 Incorrect 25 ms 40148 KB Output isn't correct
3 Halted 0 ms 0 KB -