# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91103 | 2018-12-26T09:26:59 Z | Aydarov03 | Bank (IZhO14_bank) | C++14 | 82 ms | 7936 KB |
#include <stdio.h> #include <stdlib.h> #include <vector> #include <algorithm> using namespace std; int a[25] , b[25]; vector <int> v[20005]; bool ui[25] , uj[25]; int n , m; void rec( int id = 1 , int OR = 0) { for(auto c : v[ a[id] ] ) { if( (c & OR) == 0 ) { if( id == n ) { puts("YES"); exit(0); } rec( id+1 , OR | c ); } } } main() { scanf("%d%d" , &n , &m); for(int i = 1; i <= n; i++) scanf("%d" , &a[i]); for(int i = 1; i <= m; i++) scanf("%d" , &b[i]); if( n == m ) { int ans = 0; for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { if(uj[j] || ui[i]) continue; if(a[i] == b[j]) { ui[i] = 1; uj[j] = 1; ans ++; } } } if(ans == n) puts("YES"); else puts("NO"); return 0; } for(int mask = 1; mask < (1<<m); mask++) { int sum = 0; for(int i = 0; i < m; i++) { if( mask & ( (1<<i) ) ) sum += b[i+1]; } v[sum].push_back( mask ); } for(int i = 1; i <= n; i++) { if( v[a[i]].size() == 0 ) { puts("NO"); return 0; } } rec(); puts("NO"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 788 KB | Output is correct |
2 | Correct | 2 ms | 888 KB | Output is correct |
3 | Correct | 2 ms | 888 KB | Output is correct |
4 | Correct | 4 ms | 1112 KB | Output is correct |
5 | Correct | 76 ms | 7404 KB | Output is correct |
6 | Correct | 1 ms | 7404 KB | Output is correct |
7 | Correct | 2 ms | 7404 KB | Output is correct |
8 | Correct | 74 ms | 7404 KB | Output is correct |
9 | Correct | 76 ms | 7404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 7404 KB | Output is correct |
2 | Correct | 2 ms | 7404 KB | Output is correct |
3 | Correct | 2 ms | 7404 KB | Output is correct |
4 | Correct | 2 ms | 7404 KB | Output is correct |
5 | Correct | 2 ms | 7404 KB | Output is correct |
6 | Correct | 2 ms | 7404 KB | Output is correct |
7 | Correct | 2 ms | 7404 KB | Output is correct |
8 | Correct | 2 ms | 7404 KB | Output is correct |
9 | Correct | 2 ms | 7404 KB | Output is correct |
10 | Correct | 2 ms | 7404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 7404 KB | Output is correct |
2 | Correct | 3 ms | 7404 KB | Output is correct |
3 | Correct | 3 ms | 7404 KB | Output is correct |
4 | Correct | 2 ms | 7404 KB | Output is correct |
5 | Correct | 3 ms | 7404 KB | Output is correct |
6 | Correct | 4 ms | 7404 KB | Output is correct |
7 | Correct | 3 ms | 7404 KB | Output is correct |
8 | Correct | 3 ms | 7404 KB | Output is correct |
9 | Correct | 3 ms | 7404 KB | Output is correct |
10 | Correct | 4 ms | 7404 KB | Output is correct |
11 | Correct | 2 ms | 7404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 788 KB | Output is correct |
2 | Correct | 2 ms | 888 KB | Output is correct |
3 | Correct | 2 ms | 888 KB | Output is correct |
4 | Correct | 4 ms | 1112 KB | Output is correct |
5 | Correct | 76 ms | 7404 KB | Output is correct |
6 | Correct | 1 ms | 7404 KB | Output is correct |
7 | Correct | 2 ms | 7404 KB | Output is correct |
8 | Correct | 74 ms | 7404 KB | Output is correct |
9 | Correct | 76 ms | 7404 KB | Output is correct |
10 | Correct | 2 ms | 7404 KB | Output is correct |
11 | Correct | 2 ms | 7404 KB | Output is correct |
12 | Correct | 2 ms | 7404 KB | Output is correct |
13 | Correct | 2 ms | 7404 KB | Output is correct |
14 | Correct | 2 ms | 7404 KB | Output is correct |
15 | Correct | 2 ms | 7404 KB | Output is correct |
16 | Correct | 2 ms | 7404 KB | Output is correct |
17 | Correct | 2 ms | 7404 KB | Output is correct |
18 | Correct | 2 ms | 7404 KB | Output is correct |
19 | Correct | 2 ms | 7404 KB | Output is correct |
20 | Correct | 4 ms | 7404 KB | Output is correct |
21 | Correct | 3 ms | 7404 KB | Output is correct |
22 | Correct | 3 ms | 7404 KB | Output is correct |
23 | Correct | 2 ms | 7404 KB | Output is correct |
24 | Correct | 3 ms | 7404 KB | Output is correct |
25 | Correct | 4 ms | 7404 KB | Output is correct |
26 | Correct | 3 ms | 7404 KB | Output is correct |
27 | Correct | 3 ms | 7404 KB | Output is correct |
28 | Correct | 3 ms | 7404 KB | Output is correct |
29 | Correct | 4 ms | 7404 KB | Output is correct |
30 | Correct | 2 ms | 7404 KB | Output is correct |
31 | Correct | 77 ms | 7420 KB | Output is correct |
32 | Correct | 73 ms | 7420 KB | Output is correct |
33 | Correct | 77 ms | 7420 KB | Output is correct |
34 | Correct | 81 ms | 7420 KB | Output is correct |
35 | Correct | 82 ms | 7936 KB | Output is correct |
36 | Incorrect | 2 ms | 7936 KB | Output isn't correct |
37 | Halted | 0 ms | 0 KB | - |