Submission #579613

# Submission time Handle Problem Language Result Execution time Memory
579613 2022-06-19T13:34:40 Z wdjpng Uplifting Excursion (BOI22_vault) C++17
0 / 100
2 ms 468 KB
#include <bits/stdc++.h>


#define int long long
#define rep(i,n) for(int i = 0; i < n; i++)

using namespace std;

signed main()
{
    int m,l;
    cin>>m>>l;
    vector<int>dp(2*l+1, -1);
    dp[l]=0;
    for(int cl = -m; cl <= m; cl++)
    {
        int a;
        cin>>a;
        rep(whatever,a)
        {
            rep(i,2*l+1) 
            {
                if(i-cl<0||i-cl>=dp.size()||dp[i-cl]==-1) continue;
                dp[i]=max(dp[i], dp[i-cl]+1);
            }
        }
    }
    if(dp[2*l]>0) cout<<dp[2*l]<<'\n';
    else cout<<"impossible\n";
}

Compilation message

vault.cpp: In function 'int main()':
vault.cpp:23:32: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |                 if(i-cl<0||i-cl>=dp.size()||dp[i-cl]==-1) continue;
      |                            ~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 2 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 2 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 2 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 2 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 2 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -