# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370473 | Fysty | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define F first
#define S second
#define pb push_back
vector<int> find_subset(int l, int u, vector<int> w)
{
vector<int> ans;
vector<pll> a;
rep(i,w.size()) a.pb({w[i],i});
sort(a.begin(),a.end());
int n=w.size(),sum=0;
for(int i=n-1;i>=1;i--)
{
sum+=a[i].F;
}
ll tot=0,cur=2;
rep(i,n+1)
{
while(tot+sum>u&&cur<=n-1) sum-=a[cur].F,cur++;
if(tot+sum>=l)
{
rep(j,i) ans.pb(a[j].S);
for(int j=cur;j<n;j++) ans.pb(a[j].S);
break;
}
if(i==n) break;
tot+=a[i].F;
}
return ans;
}
Compilation message (stderr)
# | 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... |