Submission #936515

#TimeUsernameProblemLanguageResultExecution timeMemory
936515tamir1Bank (IZhO14_bank)C++14
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; int n,m,a[30],b[30],i,j,x; int main(){ freopen("bank.in","r",stdin); freopen("bank.out","w",stdout); cin >> n >> m; for(i=0;i<n;i++) cin >> a[i]; for(i=0;i<m;i++) cin >> b[i]; if(n==1) x=a[0]; for(i=0;i<(1<<m);i++){ int sum=0; for(j=0;j<m;j++){ if(i&(1<<j)) sum+=b[j]; } if(sum==x){ cout << "YES"; return 0; } } cout << "NO"; }

Compilation message (stderr)

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