제출 #956326

#제출 시각아이디문제언어결과실행 시간메모리
956326Trisanu_Das은행 (IZhO14_bank)C++17
컴파일 에러
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"; }

컴파일 시 표준 에러 (stderr) 메시지

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