# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
167604 |
2019-12-09T05:21:40 Z |
Trickster |
Bank (IZhO14_bank) |
C++14 |
|
321 ms |
50680 KB |
//Suleyman Atayew
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#define N 10010
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define inf 1000000007
#define pii pair <ll, ll>
using namespace std;
ll sum;
ll n, m;
ll v[N];
ll arr[N];
int dp[30][(1<<21)];
vector <int> E[30];
void bit(int x, int y)
{
if(x == n) {
cout << "YES";
exit(0);
}
if(dp[x][y]) return;
dp[x][y] = 1;
for(auto i: E[x+1])
if((i&y) == 0) bit(x+1, (i | y));
}
int main()
{
cin >> n >> m;
for(int i = 1; i <= n; i++) cin >> v[i];
for(int i = 0; i < m; i++) cin >> arr[i];
for(int h = 0; h < (1<<m); h++) {
int sum = 0;
for(int j = 0; j < m; j++)
if((h&(1<<j))) sum += arr[j];
for(int i = 1; i <= n; i++)
if(sum == v[i]) E[i].pb(h);
}
bit(0, 0);
cout << "NO";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
380 KB |
Output is correct |
5 |
Correct |
84 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
83 ms |
376 KB |
Output is correct |
9 |
Correct |
84 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
3 ms |
376 KB |
Output is correct |
7 |
Correct |
3 ms |
376 KB |
Output is correct |
8 |
Correct |
3 ms |
376 KB |
Output is correct |
9 |
Correct |
3 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
3 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
380 KB |
Output is correct |
5 |
Correct |
84 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
83 ms |
376 KB |
Output is correct |
9 |
Correct |
84 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
3 ms |
376 KB |
Output is correct |
21 |
Correct |
3 ms |
376 KB |
Output is correct |
22 |
Correct |
3 ms |
376 KB |
Output is correct |
23 |
Correct |
3 ms |
376 KB |
Output is correct |
24 |
Correct |
3 ms |
376 KB |
Output is correct |
25 |
Correct |
3 ms |
376 KB |
Output is correct |
26 |
Correct |
3 ms |
376 KB |
Output is correct |
27 |
Correct |
3 ms |
376 KB |
Output is correct |
28 |
Correct |
3 ms |
376 KB |
Output is correct |
29 |
Correct |
3 ms |
376 KB |
Output is correct |
30 |
Correct |
3 ms |
256 KB |
Output is correct |
31 |
Correct |
84 ms |
372 KB |
Output is correct |
32 |
Correct |
85 ms |
532 KB |
Output is correct |
33 |
Correct |
90 ms |
504 KB |
Output is correct |
34 |
Correct |
91 ms |
376 KB |
Output is correct |
35 |
Correct |
92 ms |
376 KB |
Output is correct |
36 |
Correct |
103 ms |
504 KB |
Output is correct |
37 |
Correct |
84 ms |
376 KB |
Output is correct |
38 |
Correct |
86 ms |
376 KB |
Output is correct |
39 |
Correct |
91 ms |
412 KB |
Output is correct |
40 |
Correct |
93 ms |
376 KB |
Output is correct |
41 |
Correct |
103 ms |
376 KB |
Output is correct |
42 |
Correct |
102 ms |
10104 KB |
Output is correct |
43 |
Correct |
91 ms |
1144 KB |
Output is correct |
44 |
Correct |
100 ms |
504 KB |
Output is correct |
45 |
Correct |
86 ms |
376 KB |
Output is correct |
46 |
Correct |
89 ms |
376 KB |
Output is correct |
47 |
Correct |
101 ms |
372 KB |
Output is correct |
48 |
Correct |
86 ms |
376 KB |
Output is correct |
49 |
Correct |
84 ms |
372 KB |
Output is correct |
50 |
Correct |
104 ms |
632 KB |
Output is correct |
51 |
Correct |
91 ms |
632 KB |
Output is correct |
52 |
Correct |
91 ms |
404 KB |
Output is correct |
53 |
Correct |
91 ms |
504 KB |
Output is correct |
54 |
Correct |
103 ms |
504 KB |
Output is correct |
55 |
Correct |
103 ms |
632 KB |
Output is correct |
56 |
Correct |
103 ms |
636 KB |
Output is correct |
57 |
Correct |
321 ms |
50680 KB |
Output is correct |
58 |
Correct |
103 ms |
504 KB |
Output is correct |