#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long int
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<pair<int,int> > ww;
for(int i=0; i<(int)w.size(); i++) {
ww.push_back({w[i],i});
}
sort(ww.begin(),ww.end());
vector<int> ans;
int a=0;
int r=0;
int n=(int)w.size();
ll sum=0;
for(int i=0; i<n; i++) {
if(sum+ww[i].x<=l) {sum+=ww[i].x; r=i;}
else{
break;
}
}
while(r<n) {
if(sum>=l&&sum<=u) {
break;
}
sum+=ww[++r].x;
sum-=ww[a++].x;
}
for(int i=a; i<=r; i++) {
ans.push_back(ww[i].y);
}
if(ans.size()) return ans;
return std::vector<int>(0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
2 ms |
384 KB |
OK (n = 12, answer = YES) |
3 |
Incorrect |
2 ms |
384 KB |
sum of weights should be in [307..317] but it is 305 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |