# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
550766 | 2022-04-19T05:25:34 Z | AJ00 | Bank (IZhO14_bank) | C++14 | 61 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; int from[20],achieve[20]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int tc=1,n,q,k,m; //cin >> tc; for (int poppo = 1; poppo <= tc; poppo++){ cin >> n >> m; for (int i = 0; i < n; i++){ cin >> achieve[i]; } sort(achieve,achieve+n); for (int i = 0; i < m; i++){ cin >> from[i]; } sort(from,from+m); bool pos = false; for (int mask = 0; mask < (1<<m); mask++){ int cursum = 0,curitr=0; for (int i = 0; i < m; i++){ if ((1<<i)&mask){ cursum += from[i]; if (cursum == achieve[curitr]){ curitr++; cursum = 0; } } } if (curitr == n){ pos = true; break; } } pos ? cout << "YES\n" : cout << "NO\n"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 61 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 61 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 61 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 61 ms | 212 KB | Output is correct |
10 | Incorrect | 0 ms | 212 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |