Submission #1098156

#TimeUsernameProblemLanguageResultExecution timeMemory
1098156vjudge1Bank (IZhO14_bank)C++17
0 / 100
3 ms604 KiB
#include <bits/stdc++.h> #define int unsigned long using namespace std; signed main() { freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); int n, m; cin >> n >> m; bool q=false; vector<int> a(n),ba(m); for(int i=0;i<n;i++){ cin >> a[i]; } for(int i=0;i<m;i++){ cin >> ba[i]; } vector<bool> dp(5000,false); dp[0]=true; for(int b : ba){ for(int j=5000;j>=b;j--){ if (dp[j-b]) { dp[j]=true; } } } for(int s : a){ if(!dp[s]){ cout << "NO"; return 0; } } cout << "YES"; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:11:14: warning: unused variable 'q' [-Wunused-variable]
   11 |         bool q=false;
      |              ^
bank.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen("bank.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     freopen("bank.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...