#include "molecules.h"
#include <algorithm>
#define ff first
#define ss second
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
using ll = long long;
using namespace std;
const int N = 200005;
pair<ll, int> we[N];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int n = w.size();
REP(i, 1, n+1) {
we[i].ff = w[i-1];
we[i].ss = i;
}
vector<int> ret;
sort(we+1, we+n+1);
REP(i, 1, n+1) we[i].ff += we[i-1].ff;
int ri = 1, le = 1;
while(ri <= n) {
while(ri <= n && we[ri].ff - we[le-1].ff < l) ++ri;
while(le <= ri && ri <= n && we[ri].ff - we[le-1].ff > u) ++le;
if(le <= ri && ri <= n && we[ri].ff - we[le-1].ff >= l && we[ri].ff - we[le-1].ff <= u) {
REP(i, le, ri+1)
ret.push_back(we[i].ss-1);
return ret;
}
}
ret.push_back(-1);
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Integer -1 violates the range [0, 0] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
256 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
4 ms |
256 KB |
OK (n = 12, answer = YES) |
3 |
Incorrect |
4 ms |
256 KB |
Integer -1 violates the range [0, 11] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Integer -1 violates the range [0, 0] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Integer -1 violates the range [0, 0] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Integer -1 violates the range [0, 0] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Integer -1 violates the range [0, 0] |
2 |
Halted |
0 ms |
0 KB |
- |