제출 #1098141

#제출 시각아이디문제언어결과실행 시간메모리
1098141vjudge1은행 (IZhO14_bank)C++17
71 / 100
1084 ms67672 KiB
#pragma GCC optimize("O3") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> #define len(x) (int)x.size() #define pb push_back using namespace std; const int N = 2e5 + 7; int a[1001], b[1001]; int cnt[N * 10]; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m; bool ans = 0; cin >> n >> m; set <int> s; s.insert(0); for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1, greater<int>()); for (int i = 0; i < m; i++) cin >> b[i]; for (int i = 1; i <= n; i++) { vector <int> nw; for (int mask = 1; mask < (1 << m); mask++) { int sum = 0; for (int j = 0; j < m; j++) sum += b[j] * ((mask >> j) & 1); if (sum != a[i]) continue; // cout << sum << '\n'; for (int it: s) if (!(it & mask)) nw.pb((it | mask)); } s.clear(); for (int it: nw) s.insert(it); } cout << (len(s) ? "YES" : "NO"); }

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

bank.cpp: In function 'int main()':
bank.cpp:23:7: warning: unused variable 'ans' [-Wunused-variable]
   23 |  bool ans = 0;
      |       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...