# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
599639 | Summers | Detecting Molecules (IOI16_molecules) | C++14 | 4 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 "molecules.h"
#include<bits/stdc++.h>
using namespace std;
struct str
{
long long num,ind;
}a[1000000];
bool cmp(str a1, str a2)
{
return a1.num<a2.num;
}
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<int>v;
long long le=0, i, ri=0, n=w.size(), sum=0;
for(i=0;i<n;i++)
{
a[i].num=w[i];
a[i].ind=i;
}
sort(a,a+n,cmp);
sum+=a[0].num;
if(sum>=l && sum<=u)
{
v.push_back(a[0].ind);
return v;
}
while(ri<=n-1)
{
ri++;
sum+=a[ri].num;
if(sum>=l && sum<=u)
{
for(i=le;i<=ri;i++)v.push_back(a[i].ind);
return v;
}
while(sum>u && le<=ri)
{
sum-=a[le].num;
le++;
}
if(sum>=l && sum<=u)
{
for(i=le;i<=ri;i++)v.push_back(a[i].ind);
return v;
}
}
}
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... |