Submission #501412

#TimeUsernameProblemLanguageResultExecution timeMemory
501412IOI_champion_in_1980Bank (IZhO14_bank)C++14
0 / 100
3 ms380 KiB
#include <bits/stdc++.h> #include <math.h> typedef long long ll; using namespace std; ll i, j, t, a, n, m, b, c, d, f, g; int main() { ios::sync_with_stdio(0); cin.tie(0); freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); cin>>n>>m; vector <int> vn(n); vector <int> vm(m); for (a=0; a<n; a++) { cin>>vn[a]; } for (a=0; a<m; a++) { cin>>vm[a]; } if (n>m) { cout<<"NO"<<endl; return 0; } vector <int> vc(m); for (a=0; a<m; a++) vc[a]=a; do { int c=0, jem=0; for (a=0; a<m; a++) { jem=jem+vm[vc[a]]; if (jem==vn[c]) { jem=0; c++; } if (jem>vn[c]) { c=0; break; } } if (c==n) { cout<<"YES"<<endl; return 0; } } while(next_permutation(vc.begin(), vc.end())); cout<<"NO"<<endl; } /* 1 5 8 4 2 5 1 3 */

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:11:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  freopen("bank.in", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:12:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  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...