## Submission #851217

# Submission time Handle Problem Language Result Execution time Memory
851217 2023-09-18T21:30:31 Z NamPE Bank (IZhO14_bank) C++17
100 / 100
107 ms 17068 KB
```#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
ll n, m;
cin >> n >> m;

vector<ll> a(n), b(m);

for (ll& i : a) {
cin >> i;
}

for (ll& i : b) {
cin >> i;
}

vector<ll> covered(1 << m, -1), leftover(1 << m, -1);
covered[0] = leftover[0] = 0;

for (ll i = 0; i < covered.size(); i++) {
for (ll j = 0; j < m; j++) {
if (!(i & (1 << j))) {
continue;
}

ll prev = i ^ (1 << j);

if (covered[prev] == -1) {
continue;
}

ll total = leftover[prev] + b[j];
ll salary = a[covered[prev]];

if (total == salary) {
covered[i] = covered[prev] + 1;
leftover[i] = 0;
} else if (total < salary) {
covered[i] = covered[prev];
leftover[i] = total;
}
}

if(covered[i] == n) {
cout << "YES";
return 0;
}
}

cout << "NO";
}```

### Compilation message

```bank.cpp: In function 'int main()':
bank.cpp:23:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
23 |     for (ll i = 0; i < covered.size(); i++) {
|                    ~~^~~~~~~~~~~~~~~~```

#### Subtask #1 19.0 / 19.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
5 Correct 81 ms 16856 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 5 ms 16732 KB Output is correct
9 Correct 83 ms 16848 KB Output is correct

#### Subtask #2 25.0 / 25.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 356 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct

#### Subtask #3 27.0 / 27.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 2 ms 692 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct

#### Subtask #4 29.0 / 29.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
5 Correct 81 ms 16856 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 5 ms 16732 KB Output is correct
9 Correct 83 ms 16848 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 356 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
21 Correct 1 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 2 ms 692 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 99 ms 16732 KB Output is correct
32 Correct 97 ms 16852 KB Output is correct
33 Correct 77 ms 16732 KB Output is correct
34 Correct 72 ms 16848 KB Output is correct
35 Correct 74 ms 16848 KB Output is correct
36 Correct 73 ms 16732 KB Output is correct
37 Correct 74 ms 16728 KB Output is correct
38 Correct 73 ms 16732 KB Output is correct
39 Correct 4 ms 16732 KB Output is correct
40 Correct 76 ms 16732 KB Output is correct
41 Correct 73 ms 17068 KB Output is correct
42 Correct 107 ms 16848 KB Output is correct
43 Correct 73 ms 16728 KB Output is correct
44 Correct 82 ms 16728 KB Output is correct
45 Correct 4 ms 16732 KB Output is correct
46 Correct 88 ms 16820 KB Output is correct
47 Correct 76 ms 16732 KB Output is correct
48 Correct 4 ms 16728 KB Output is correct
49 Correct 74 ms 16848 KB Output is correct
50 Correct 84 ms 16844 KB Output is correct
51 Correct 72 ms 16732 KB Output is correct
52 Correct 74 ms 16732 KB Output is correct
53 Correct 97 ms 16984 KB Output is correct
54 Correct 91 ms 16732 KB Output is correct
55 Correct 86 ms 16844 KB Output is correct
56 Correct 84 ms 16848 KB Output is correct
57 Correct 81 ms 16728 KB Output is correct
58 Correct 84 ms 16852 KB Output is correct