# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
739916 |
2023-05-11T15:23:56 Z |
Desh03 |
Bank (IZhO14_bank) |
C++17 |
|
1 ms |
212 KB |
#include <bits/stdc++.h>
using namespace std;
bool dp[20][1001];
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n), b(m), ok(n);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < m; i++) cin >> b[i];
for (int i = 0; i < m; i++) dp[i][0] = 1;
for (int i = 0; i < m; i++)
for (int j = 0; j <= 1000; j++)
if (j + b[i] <= 1000)
dp[i][j + b[i]] |= dp[i][j];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
if (dp[j][a[i]])
ok[i] = 1;
for (int i = 0; i < n; i++)
if (!ok[i]) {
cout << "NO";
return 0;
}
cout << "YES";
}
# |
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 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
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 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |