Submission #655541

#TimeUsernameProblemLanguageResultExecution timeMemory
655541iskhakkutbilimBank (IZhO14_bank)C++14
19 / 100
60 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define all(a) a.begin(), a.end() const int M = 1e9 + 7; const int N = 1e6 + 1; main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // ifstream cin("bank.in"); // ofstream cout("bank.out"); int n, m; cin >> n >> m; int a[n], b[m]; for(int i = 0;i < n; i++){ cin >> a[i]; } for(int i = 0;i < m; i++){ cin >> b[i]; } for(int mask = 0; mask < (1<<m); mask++){ int sum = 0; for(int i = 0;i < m; i++){ if(mask & (1<<i)){ sum+= b[i]; } } if(sum == a[0]){ cout << "YES"; return 0; } } cout << "NO"; return 0; }

Compilation message (stderr)

bank.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...