# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
87001 |
2018-11-29T06:08:49 Z |
mirbek01 |
Bank (IZhO14_bank) |
C++17 |
|
1000 ms |
4896 KB |
# include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 2;
int n, m, a[N], b[N], sum[2000000];
vector <int> vec[N];
void f(int i, int mask){
if(i == n){
puts("YES");
exit(0);
}
for(int j = 0; j < vec[i].size(); j ++){
int now = vec[i][j];
if(mask & now) continue;
f(i + 1, mask | now);
}
}
int main(){
cin >> n >> m;
for(int i = 0; i < n; i ++){
cin >> a[i];
}
for(int i = 0; i < m; i ++){
cin >> b[i];
}
for(int mask = 0; mask < (1 << m); mask ++){
for(int j = 0; j < m; j ++)
if(mask & (1 << j))
sum[mask] += b[j];
}
for(int i = 0; i < n; i ++){
for(int mask = 0; mask < (1 << m); mask ++){
if(sum[mask] == a[i])
vec[i].push_back(mask);
}
}
f(0, 0);
puts("NO");
}
Compilation message
bank.cpp: In function 'void f(int, int)':
bank.cpp:15:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0; j < vec[i].size(); j ++){
~~^~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
440 KB |
Output is correct |
3 |
Correct |
2 ms |
440 KB |
Output is correct |
4 |
Correct |
5 ms |
620 KB |
Output is correct |
5 |
Correct |
72 ms |
4556 KB |
Output is correct |
6 |
Correct |
2 ms |
4556 KB |
Output is correct |
7 |
Correct |
2 ms |
4556 KB |
Output is correct |
8 |
Correct |
72 ms |
4720 KB |
Output is correct |
9 |
Correct |
72 ms |
4720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4720 KB |
Output is correct |
2 |
Correct |
2 ms |
4720 KB |
Output is correct |
3 |
Correct |
2 ms |
4720 KB |
Output is correct |
4 |
Correct |
2 ms |
4720 KB |
Output is correct |
5 |
Correct |
2 ms |
4720 KB |
Output is correct |
6 |
Correct |
2 ms |
4720 KB |
Output is correct |
7 |
Correct |
2 ms |
4720 KB |
Output is correct |
8 |
Correct |
2 ms |
4720 KB |
Output is correct |
9 |
Correct |
2 ms |
4720 KB |
Output is correct |
10 |
Correct |
2 ms |
4720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4720 KB |
Output is correct |
2 |
Correct |
2 ms |
4720 KB |
Output is correct |
3 |
Correct |
3 ms |
4720 KB |
Output is correct |
4 |
Correct |
3 ms |
4720 KB |
Output is correct |
5 |
Correct |
3 ms |
4720 KB |
Output is correct |
6 |
Correct |
2 ms |
4720 KB |
Output is correct |
7 |
Correct |
2 ms |
4720 KB |
Output is correct |
8 |
Correct |
2 ms |
4720 KB |
Output is correct |
9 |
Correct |
3 ms |
4720 KB |
Output is correct |
10 |
Correct |
3 ms |
4720 KB |
Output is correct |
11 |
Correct |
3 ms |
4720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
440 KB |
Output is correct |
3 |
Correct |
2 ms |
440 KB |
Output is correct |
4 |
Correct |
5 ms |
620 KB |
Output is correct |
5 |
Correct |
72 ms |
4556 KB |
Output is correct |
6 |
Correct |
2 ms |
4556 KB |
Output is correct |
7 |
Correct |
2 ms |
4556 KB |
Output is correct |
8 |
Correct |
72 ms |
4720 KB |
Output is correct |
9 |
Correct |
72 ms |
4720 KB |
Output is correct |
10 |
Correct |
2 ms |
4720 KB |
Output is correct |
11 |
Correct |
2 ms |
4720 KB |
Output is correct |
12 |
Correct |
2 ms |
4720 KB |
Output is correct |
13 |
Correct |
2 ms |
4720 KB |
Output is correct |
14 |
Correct |
2 ms |
4720 KB |
Output is correct |
15 |
Correct |
2 ms |
4720 KB |
Output is correct |
16 |
Correct |
2 ms |
4720 KB |
Output is correct |
17 |
Correct |
2 ms |
4720 KB |
Output is correct |
18 |
Correct |
2 ms |
4720 KB |
Output is correct |
19 |
Correct |
2 ms |
4720 KB |
Output is correct |
20 |
Correct |
3 ms |
4720 KB |
Output is correct |
21 |
Correct |
2 ms |
4720 KB |
Output is correct |
22 |
Correct |
3 ms |
4720 KB |
Output is correct |
23 |
Correct |
3 ms |
4720 KB |
Output is correct |
24 |
Correct |
3 ms |
4720 KB |
Output is correct |
25 |
Correct |
2 ms |
4720 KB |
Output is correct |
26 |
Correct |
2 ms |
4720 KB |
Output is correct |
27 |
Correct |
2 ms |
4720 KB |
Output is correct |
28 |
Correct |
3 ms |
4720 KB |
Output is correct |
29 |
Correct |
3 ms |
4720 KB |
Output is correct |
30 |
Correct |
3 ms |
4720 KB |
Output is correct |
31 |
Correct |
74 ms |
4736 KB |
Output is correct |
32 |
Correct |
77 ms |
4800 KB |
Output is correct |
33 |
Correct |
86 ms |
4800 KB |
Output is correct |
34 |
Correct |
92 ms |
4800 KB |
Output is correct |
35 |
Correct |
95 ms |
4800 KB |
Output is correct |
36 |
Correct |
118 ms |
4844 KB |
Output is correct |
37 |
Correct |
74 ms |
4844 KB |
Output is correct |
38 |
Correct |
79 ms |
4844 KB |
Output is correct |
39 |
Correct |
89 ms |
4844 KB |
Output is correct |
40 |
Correct |
94 ms |
4844 KB |
Output is correct |
41 |
Correct |
117 ms |
4844 KB |
Output is correct |
42 |
Correct |
163 ms |
4844 KB |
Output is correct |
43 |
Correct |
88 ms |
4844 KB |
Output is correct |
44 |
Correct |
105 ms |
4844 KB |
Output is correct |
45 |
Correct |
77 ms |
4844 KB |
Output is correct |
46 |
Correct |
84 ms |
4844 KB |
Output is correct |
47 |
Correct |
106 ms |
4844 KB |
Output is correct |
48 |
Correct |
73 ms |
4844 KB |
Output is correct |
49 |
Correct |
71 ms |
4844 KB |
Output is correct |
50 |
Correct |
116 ms |
4844 KB |
Output is correct |
51 |
Correct |
100 ms |
4844 KB |
Output is correct |
52 |
Correct |
93 ms |
4896 KB |
Output is correct |
53 |
Correct |
94 ms |
4896 KB |
Output is correct |
54 |
Correct |
117 ms |
4896 KB |
Output is correct |
55 |
Correct |
116 ms |
4896 KB |
Output is correct |
56 |
Correct |
119 ms |
4896 KB |
Output is correct |
57 |
Execution timed out |
1074 ms |
4896 KB |
Time limit exceeded |
58 |
Halted |
0 ms |
0 KB |
- |