제출 #1098386

#제출 시각아이디문제언어결과실행 시간메모리
1098386vjudge1은행 (IZhO14_bank)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n), b(m); for(auto &i : a) { cin >> i; } for(auto &i : b) { cin >> i; } vector<int> l(1 << m, -1), r(1 << m, -1); l[0] = r[0] = 0; for(int i = 0; i < (1 << m); i++) { for(int j = 0; j < m; j++) { int k = i ^ (1 << j); if(!(i & (1 << j)) || r[k] == -1) { continue; } int new = l[k] + b[j]; int cur = a[r[k]]; if(new < cur) { r[i] = r[k]; l[i] = new; } else if(new == cur) { r[i] = r[k] + 1; l[i] = 0; } } if(r[i] == n) { cout << "YES"; return 0; } } cout << "NO"; }

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

bank.cpp: In function 'int main()':
bank.cpp:27:17: error: expected unqualified-id before 'new'
   27 |             int new = l[k] + b[j];
      |                 ^~~
bank.cpp:29:20: error: expected type-specifier before '<' token
   29 |             if(new < cur)
      |                    ^
bank.cpp:32:27: error: expected type-specifier before ';' token
   32 |                 l[i] = new;
      |                           ^
bank.cpp:34:25: error: expected type-specifier before '==' token
   34 |             else if(new == cur)
      |                         ^~