Submission #1013025

#TimeUsernameProblemLanguageResultExecution timeMemory
1013025vjudge1Bank (IZhO14_bank)C++17
71 / 100
1012 ms8272 KiB
#include<bits/stdc++.h> using namespace std; int n, m, a[1001], b[1001]; vector<int> v[20001]; void rec(int i, int mask){ if(i == n){ cout << "YES"; exit(0); } for(auto to : v[a[i]]){ if((to & mask) == 0){ rec(i+1, mask ^ to); } } } main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for(int i = 0; i < n; i++){ cin >> a[i]; } for(int j = 0; j < m; j++){ cin >> b[j]; } for(int mask = 0; mask < (1<<m); mask++){ int sum = 0; for(int j = 0; j < m; j++){ if(mask & (1 << j)){ sum += b[j]; } } v[sum].push_back(mask); } rec(0, 0); cout << "NO"; }

Compilation message (stderr)

bank.cpp:16:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   16 |  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...