Submission #956326

#TimeUsernameProblemLanguageResultExecution timeMemory
956326Trisanu_DasBank (IZhO14_bank)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main(){ 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]; vector<int> cover(1 << m, -1), left(1 << m, -1); left[0] = cover[0] = 0; for(int mask = 1; mask < (1 << m); mask++){ for(int last = 0; last < m; last++){ if(!(mask & (1 << last))) continue; int p = mask & ~(1 << last); if(cover[p] == -1) continue; int new_ = left[p] + b[last], target = a[cover[p]]; if(new_ < target){ cover[mask] = cover[p]; left[mask] = new_ }else if(new_ == target){ cover[mask] = cover[p] + 1; left[mask] = 0; } } if(cover[mask] == n){ cout << "YES\n"; return 0; } } cout << "NO\n"; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:19:26: error: expected ';' before '}' token
   19 |         left[mask] = new_
      |                          ^
      |                          ;
   20 |       }else if(new_ == target){
      |       ~