#include "molecules.h"
#include <iostream>
#include <vector>
#include <map>
#include <cassert>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
const int N = w.size();
map< int,vector<int> > MAP;
for (int i = 0; i < N; ++i)
MAP[ w[i] ].push_back(i);
assert(MAP.size() == 2);
int N1 = MAP.begin()->second.size();
int W1 = MAP.begin()->first;
int N2 = MAP.rbegin()->second.size();
int W2 = MAP.rbegin()->first;
for (int n1 = 0; n1 <= N1; ++n1) {
for (int n2 = 0; n2 <= N2; ++n2) {
long long sum = n1 * W1 + n2 * W2;
if (l <= sum && sum <= u) {
vector<int> res;
for (int i = 0; i < n1; ++i)
res.push_back( MAP[W1][i] );
for (int i = 0; i < n2; ++i)
res.push_back( MAP[W2][i] );
return res;
}
}
}
return {};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 6, answer = YES) |
10 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
11 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |