Submission #501052

#TimeUsernameProblemLanguageResultExecution timeMemory
501052EliteCallsYouBank (IZhO14_bank)C++17
19 / 100
55 ms332 KiB
# include <bits/stdc++.h> using namespace std ; //############################################################################ # define read(a)/**/for(int i=0;i<int(sizeof(a)/sizeof(a[0]));i++){cin>>a[i];} # define print(x)/**/for(auto zx:x){cout<<zx<<' ';} const char* tochar(string a){return a.c_str();} void files(){freopen("planting.in","r",stdin);freopen("planting.out","w",stdout);} void speed(){ios_base::sync_with_stdio(false);cin.tie(0);} long long gcd(long long a,long long b){if(!b){return a;}a%=b;return gcd(b,a);} long long lcm(long long a,long long b){return a /gcd(a,b) * b;} //########################################################################### const int N = 1e5 + 5 ; const long long MOD = 1e17+7 ; //########################################################################### void hack(){} //########################################################################### int main(){ int n, m ; cin >> n >> m ; int s[n], c[m] ; for ( int i = 0 ; i < n ; i ++ ){ cin >> s[i] ; } for ( int i = 0 ; i < m ; i ++ ){ cin >> c[i] ; } for ( int i = 0 ; i < (1<<20) ; i ++ ){ int sum = 0 ; for ( int bit = 0 ; bit < min(20,m) ; bit ++ ){ if ( ((1<<bit)&i) ){ sum += c[bit] ; } } if ( sum == s[0] ){ cout << "YES\n" ; return 0 ; } } cout << "NO\n" ; }

Compilation message (stderr)

bank.cpp: In function 'void files()':
bank.cpp:7:21: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | void files(){freopen("planting.in","r",stdin);freopen("planting.out","w",stdout);}
      |              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:7:54: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | void files(){freopen("planting.in","r",stdin);freopen("planting.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...