# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
739954 |
2023-05-11T18:26:31 Z |
Toxtaq |
Bank (IZhO14_bank) |
C++17 |
|
1000 ms |
212 KB |
#include<bits/stdc++.h>
using namespace std;
int n, m;
vector<int>people, banknotes;
bool rec(int indx, int mask, int cur_people){
if(indx == n)return 1;
if(cur_people < 0)return 0;
if(cur_people == 0)indx++;
bool res = 0;
for(int i = 0;i < m;++i){
if(mask & (1 << i)){
res = res | rec(indx, mask ^ (1 << i), cur_people - banknotes[i]);
}
}
return res;
}
int main()
{
cin >> n >> m;
people.resize(n);
banknotes.resize(m);
for(int i = 0;i < n;++i)cin >> people[i];
for(int i = 0;i < m;++i)cin >> banknotes[i];
if(rec(0, (1 << m) - 1, people[0])){
cout << "YES";
}
else{
cout << "NO";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Execution timed out |
1085 ms |
212 KB |
Time limit exceeded |
5 |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Execution timed out |
1085 ms |
212 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |