# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
785070 | Lyrically | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 212 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;
#define pii pair<int,int>
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int read(){int x;scanf("%d",&x);return x;}
void print(int x){printf("%d\n",x);}
void file(string s)
{
freopen((s+".in").c_str(),"r",stdin);
freopen((s+".out").c_str(),"w",stdout);
}
const int mod=998244353;
vector<int> find_subset(int l,int r,vector<int> w)
{
vector<pii> v;
rep(i,(int)w.size())
{
v.pb({w[i],i});
}
sort(v.begin(),v.end());
long long tot=0;
int n=(int)w.size();
vector<int> res;
rep(i,n)
{
if(tot+v[i].first>r)
{
if(i==n-1){return res;}
//cout<<i<<" "<<v[0].first<<" "<<v[i].first<<" "<<v.back().first<<endl;
long long cur=tot-v[0].first+v[i].first;
if(cur>=l&&cur<=r)
{
for(int j=0;j<i;j++)
{
res.pb(v[j+1].second);
}
sort(res.begin(),res.end());
return res;
}
cur+=v.back().first;
if(cur>=l&&cur<=r)
{
for(int j=0;j<i;j++)
{
res.pb(v[j+1].second);
}
res.pb(v.back().second);
sort(res.begin(),res.end());
return res;
}
}
else if(tot+v[i].first>=l&&tot+v[i].first<=r)
{
for(int j=0;j<=i;j++)
{
res.pb(v[j].second);
}
sort(res.begin(),res.end());
return res;
}
tot+=v[i].first;
}
return res;
}
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... |