Submission #1086863

#TimeUsernameProblemLanguageResultExecution timeMemory
1086863lhlephuocdaoBank (IZhO14_bank)C++17
Compilation error
0 ms0 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; const int MAX = 20; int N, M; int a[MAX + 10], b[MAX + 10], l[MASK(MAX) + 10], f[MASK(MAX) + 10]; void solve() { cin >> N >> M; for(int i=0; i<N; i++){ cin >> a[i]; } for(int i=0; i<M; i++){ cin >> b[i]; } memset(f, -1, sizeof f); f[0] = 0; for(int mask=0; mask < (1<<M); mask++) if(f[mask] != -1){ for(int i=0; i < M; i++) if(!(mask & (1<<i))){ int x = b[i] + l[mask]; if(x < a[f[mask]]){ f[mask | (1<<i)] = f[mask]; l[mask | (1<<i)] = x; } else if(x == a[f[mask]]){ f[mask | (1<<i)] = f[mask] + 1; l[mask | (1<<i)] = 0; } if(f[mask | (1<<i)] == N){ cout << "YES\n"; return; } } } cout << "NO\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); solve(); return 0; }

Compilation message (stderr)

bank.cpp:9:33: error: 'MASK' was not declared in this scope
    9 | int a[MAX + 10], b[MAX + 10], l[MASK(MAX) + 10], f[MASK(MAX) + 10];
      |                                 ^~~~
bank.cpp:9:52: error: 'MASK' was not declared in this scope
    9 | int a[MAX + 10], b[MAX + 10], l[MASK(MAX) + 10], f[MASK(MAX) + 10];
      |                                                    ^~~~
bank.cpp: In function 'void solve()':
bank.cpp:20:12: error: 'f' was not declared in this scope
   20 |     memset(f, -1, sizeof f);
      |            ^
bank.cpp:27:36: error: 'l' was not declared in this scope
   27 |                     int x = b[i] + l[mask];
      |                                    ^