#include <bits/stdc++.h>
#define L long long
using namespace std;
int n;
L s,e;
struct S{
L idx, weight;
};
bool operator<(S a,S b){
return a.weight<b.weight;
}
vector<int> find_subset(int l,int u, vector<int> w){
n=w.size();
vector<int> ans(n);
L i;
s=l,e=u;
L W=0;
vector<S>v;
for(i=0;i<n;i++)
v.push_back((S){i,w[i]});
sort(v.begin(),v.end());
for(i=n-1;i>=0;i--)
{
W+=v[i].weight;
ans[v[i].idx]=1;
if(W>e)
{
L j=n-1;
while(i>0)
{
W+=v[i-1].weight;
ans[v[i-1].idx]=1;
W-=v[j].weight;
ans[v[j].idx]=0;
i--;j--;
if(s<=W&&W<=e) return ans;
}
break;
}
else if(W>=s)
return ans;
}
vector<int> ans2(n,0);
return ans2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
item #0 is taken twice |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |