# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
783765 | 2023-07-15T10:01:40 Z | nghiaaa | 은행 (IZhO14_bank) | C++14 | 9 ms | 388 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); freopen("bank.in","r",stdin); freopen("bank.out","w",stdout); int n,m;cin>>n>>m; multiset<int> count; int check=0; while(n--) { int ai; cin>>ai; count.insert(ai); } int a[m+1]; for (int i=0;i<m;i++) cin>>a[i]; int BIT[22]; BIT[0]=1; swap(n,m); for (int i=1;i<22;i++) BIT[i]=BIT[i-1]<<1; for (int mask=1;mask<BIT[n];mask++) { if (mask&check) continue; int sum=0; for (int i=0;i<n;i++) if (mask&BIT[i]) sum+=a[i]; if (count.find(sum)!=count.end()) { count.erase(count.find(sum)); //check|=mask; } } if (count.size()) cout<<"NO"; else cout<<"YES"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 388 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |