이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ll long long
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n=w.size(), x=0;
ll ans=0;
pair<ll, int> p[n];
bool f[n];
memset(f, 0, sizeof(f));
for (int i=0; i<n; i++)p[i]={w[i], i};
sort(p, p+n);
while(x<n&&ans+p[x].F<l)f[x]^=1,ans+=p[x++].F;
if(x<n&&ans+p[x].F>=l&&ans+p[x].F<=u){
vector<int> Ans;
for (int j=0; j<=x; j++)Ans.pb(p[j].S);
sort(Ans.begin(), Ans.end());
return Ans;
}
for (int i=x-1; i>=0; i--){
f[i+n-x]^=1; f[i]^=1;
ans+=p[i+n-x].F-p[i].F;
if(ans>=l&&ans<=u){
vector<int> Ans;
for (int j=0; j<n; j++)if(f[j])Ans.pb(p[j].S);
sort(Ans.begin(), Ans.end());
return Ans;
}
}
return vector<int>(0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |