#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
const int inf = 2e5+9;
int n,pre[inf];
pair<int,int> a[inf];
vector<int> find_subset(int l, int r, vector<int> w) {
vector<int> ans;
n = w.size();
for(int i=1;i<=n;i++)
a[i] = make_pair(w[i-1],i-1);
sort(a+1,a+1+n);
for(int i=1;i<=n;i++)
pre[i] = pre[i-1]+a[i].first;
set<pair<int,int> > s;
for(int i=1;i<=n;i++){
s.insert(make_pair(pre[i-1],i));
set< pair<int,int> > ::iterator it = s.lower_bound( make_pair( pre[i]-r , 0 ) );
if( it->first > pre[i] - l )
continue;
for(int j = it->second ; j <= i ;j++){
ans.push_back(a[j].second);
assert(a[j].second<n);
}
return ans;
/*for(int j=i;j<=n;j++){
if(pre[j] - pre[i-1] >=l && pre[j] - pre[i-1] <= r){
for(int z=i;z<=j;z++)
ans.push_back(a[z].second-1);
return ans;
}
}*/
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
OK (n = 1, answer = NO) |
2 |
Incorrect |
2 ms |
256 KB |
Integer 2 violates the range [0, 1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
2 ms |
404 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
2 ms |
376 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
2 ms |
376 KB |
OK (n = 12, answer = YES) |
6 |
Correct |
2 ms |
376 KB |
OK (n = 12, answer = YES) |
7 |
Correct |
2 ms |
376 KB |
OK (n = 12, answer = YES) |
8 |
Correct |
2 ms |
380 KB |
OK (n = 12, answer = YES) |
9 |
Correct |
2 ms |
376 KB |
OK (n = 6, answer = YES) |
10 |
Correct |
2 ms |
376 KB |
OK (n = 12, answer = YES) |
11 |
Correct |
2 ms |
376 KB |
OK (n = 100, answer = NO) |
12 |
Correct |
2 ms |
380 KB |
OK (n = 100, answer = YES) |
13 |
Correct |
2 ms |
256 KB |
OK (n = 100, answer = NO) |
14 |
Correct |
2 ms |
376 KB |
OK (n = 100, answer = YES) |
15 |
Correct |
2 ms |
376 KB |
OK (n = 100, answer = YES) |
16 |
Correct |
2 ms |
376 KB |
OK (n = 100, answer = YES) |
17 |
Correct |
2 ms |
380 KB |
OK (n = 100, answer = YES) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
OK (n = 1, answer = NO) |
2 |
Incorrect |
2 ms |
256 KB |
Integer 2 violates the range [0, 1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
OK (n = 1, answer = NO) |
2 |
Incorrect |
2 ms |
256 KB |
Integer 2 violates the range [0, 1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
OK (n = 1, answer = NO) |
2 |
Incorrect |
2 ms |
256 KB |
Integer 2 violates the range [0, 1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
OK (n = 1, answer = NO) |
2 |
Incorrect |
2 ms |
256 KB |
Integer 2 violates the range [0, 1] |
3 |
Halted |
0 ms |
0 KB |
- |