#include "molecules.h"
#include <vector>
#include <bitset>
const int DIM = 8388608; ///2^23
std::bitset <DIM> s;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
std::vector <int> ans;
s[0] = 1;
for(auto it : w)
s |= (s << it);
int p = -1;
for(int pos = l; pos <= u; pos++)
if(s[pos] == 1)
{
p = pos;
break;
}
if(p == -1)
return ans;
int pointerW = (int)w.size() - 1;
while(p > 0)
{
while(p - w[pointerW] < 0 || s[p - w[pointerW]] != 1)
pointerW--;
ans.push_back(pointerW);
p -= w[pointerW];
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3328 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
3 ms |
3328 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
3 ms |
3328 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
5 ms |
3328 KB |
item #1 is taken twice |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
3328 KB |
item #11 is taken twice |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3328 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
3 ms |
3328 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
3 ms |
3328 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
5 ms |
3328 KB |
item #1 is taken twice |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3328 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
3 ms |
3328 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
3 ms |
3328 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
5 ms |
3328 KB |
item #1 is taken twice |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3328 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
3 ms |
3328 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
3 ms |
3328 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
5 ms |
3328 KB |
item #1 is taken twice |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3328 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
3 ms |
3328 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
3 ms |
3328 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
5 ms |
3328 KB |
item #1 is taken twice |
5 |
Halted |
0 ms |
0 KB |
- |