제출 #1313537

#제출 시각아이디문제언어결과실행 시간메모리
1313537shirokito은행 (IZhO14_bank)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ForUp(i, a, b) for (int i = (a), _b = (b); i <= _b; i++) #define ForDn(i, a, b) for (int i = (a), _b = (b); i >= _b; i--) #define all(a) (a).begin(), (a).end() using ll = long long; const int N = 20; const int INF = 1e9; int n, m, a[N], b[N]; int dp[1 << N]; void solve() { cin >> n >> m; ForUp (i, 0, n - 1) { cin >> a[i]; } ForUp (i, 0, m - 1) { cin >> b[i]; } ForUp (mask, 0, (1 << m) - 1) { dp[mask] = -INF; } dp[0] = 0; int sum = 0; ForUp (i, 0, n - 1) { sum += a[i]; ForUp (mask, 0, (1 << m) - 1) { if (dp[mask] == -INF) continue; ForUp (j, 0, m - 1) if (!BIT(mask, j)) { dp[mask | (1 << j)] = dp[mask] + b[j]; } } ForUp (mask, 0, (1 << m) - 1) { if (dp[mask] != sum) dp[mask] = -INF; } } ForUp (mask, 0, (1 << m) - 1) { if (dp[mask] != -INF) { cout << "YES" << '\n'; return; } } cout << "NO" << '\n'; } signed main() { cin.tie(0) -> sync_with_stdio(0); int T = 1; // cin >> T; while (T--) { solve(); } }

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

bank.cpp: In function 'void solve()':
bank.cpp:39:38: error: 'BIT' was not declared in this scope
   39 |             ForUp (j, 0, m - 1) if (!BIT(mask, j)) {
      |                                      ^~~