Submission #701171

# Submission time Handle Problem Language Result Execution time Memory
701171 2023-02-20T10:34:27 Z Kipras Uplifting Excursion (BOI22_vault) C++17
0 / 100
1 ms 468 KB
#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

const ll maxN = 51;

ll a[maxN*2+1];

ll dp[maxN^2*2];

int main()
{

    ios_base::sync_with_stdio(0);cin.tie(nullptr);

    ll m, l;
    cin>>m>>l;

    fill(dp, dp+(int)(maxN^2*2), 0);

    for(int i = 0; i < m*2+1; i++){
        cin>>a[i];
    }

    for(int i = 0; i < m*2+1; i++){
        for(int x = 0; x < a[i]; x++){
            ll v = i-m;
            if(v<0){
                for(int z = -min(maxN^2*2+1,l*2); z <= min(maxN^2*2+1,l*2); z++){
                    if((dp[z-v]!=0||z-v==0))dp[z]=dp[z-v]+1;
                }
            }
            else{
                for(int z = min(maxN^2+1,2*l); z >= -min(maxN^2+1,2*l); z--){
                    if((dp[z-v]!=0||z-v==0))dp[z]=dp[z-v]+1;
                }
            }
        }
    }

    if(dp[l]>0)cout<<dp[l];
    else cout<<"impossible";

    return 0;
}

Compilation message

vault.cpp: In function 'int main()':
vault.cpp:31:42: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   31 |                 for(int z = -min(maxN^2*2+1,l*2); z <= min(maxN^2*2+1,l*2); z++){
      |                                       ~~~^~
vault.cpp:31:68: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   31 |                 for(int z = -min(maxN^2*2+1,l*2); z <= min(maxN^2*2+1,l*2); z++){
      |                                                                 ~~~^~
vault.cpp:36:39: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   36 |                 for(int z = min(maxN^2+1,2*l); z >= -min(maxN^2+1,2*l); z--){
      |                                      ~^~
vault.cpp:36:64: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   36 |                 for(int z = min(maxN^2+1,2*l); z >= -min(maxN^2+1,2*l); z--){
      |                                                               ~^~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -