#include <bits/stdc++.h>
#define F first
#define S second
#include "molecules.h"
using namespace std;
long long n,L,U;
pair < long long , int > p[200005];
vector < int > ANS;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
n=w.size();
int L=l,U=u;
for (int i=1; i<=n; i++) {
p[i].F=w[i-1];
p[i].S=i;
}
sort(p+1,p+n+1);
for (int i=1; i<=n; i++)
p[i].F+=p[i-1].F;
for (int i=1; i<=n; i++) {
int l=0,r=i,mid,ans=-1;
while (l<=r) {
mid=(l+r)/2;
if (L<=p[i].F-p[mid].F) { ans=mid; l=mid+1; }
else r=mid-1;
}
if (ans==-1) continue;
if (L<=p[i].F-p[ans].F && p[i].F-p[ans].F<=U) {
ANS.push_back(i-ans);
for (int j=ans+1; j<=i; j++)
ANS.push_back(p[j].S-1);
return ANS;
}
}
return std::vector<int>(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
256 KB |
Integer 2 violates the range [0, 1] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
item #6 is taken twice |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
256 KB |
Integer 2 violates the range [0, 1] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
256 KB |
Integer 2 violates the range [0, 1] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
256 KB |
Integer 2 violates the range [0, 1] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
256 KB |
Integer 2 violates the range [0, 1] |
4 |
Halted |
0 ms |
0 KB |
- |