# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
882189 | AndreiBOTO | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 348 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>
#pragma optimize GCC ("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
///#include <tryhardmode>
///#include <GODMODE::ON>
using namespace std;
vector<int>find_subset(int l,int u,vector<int>w)
{
int n,i,j;
long long kon=0;
n=w.size();
vector<pair<int,int>>a;
vector<int>ans;
for(i=0;i<n;i++)
a.push_back(make_pair(w[i],i));
sort(a.begin(),a.end());
int left=0,right=0;
while(right<n)
{
kon+=a[right].first;
if(kon<l)
right++;
else
{
while(kon>u)
{
kon-=a[left].first;
left++;
}
if(kon>=l && kon<=u)
{
for(i=left;i<right;i++)
ans.push_back(a[i].second);
return ans;
}
else
right++;
}
}
return ans;
}
/*int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
vector<int>a;
vector<int>w;
int n,i,st,dr;
cin>>n;
cin>>st>>dr;
for(i=0;i<n;i++)
{
int x;
cin>>x;
w.push_back(x);
}
a=find_subset(st,dr,w);
for(auto i:a)
cout<<i<<" ";
return 0;
}*/
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... |