Submission #1182555

#TimeUsernameProblemLanguageResultExecution timeMemory
1182555hmms127은행 (IZhO14_bank)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) int n,a[25]; long long c; bool found = false; void rec(int idx,long long sum){ if(sum==c) { found=true; return; } if(idx==n||sum>c)return; rec(idx+1,sum+a[idx]); rec(idx+1,sum); } int main() { speed; freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); int m;cin>>m>>n>>c; for (int i=0; i<n;i++) cin>>a[i]; rec(0, 0); cout<<(found?"YES":"NO"); }

Compilation message (stderr)

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