# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
997671 | AtinaR | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 432 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;
std::vector<int> find_subset(int l, int u, std::vector<int> w)
{
vector<pair<int,int> > v;
for(int i=0; i<w.size(); i++)
{
v.push_back({w[i],i});
}
sort(v.begin(),v.end());
int i=0,j=0;
int sum=0;
int n=w.size();
while(j<n)
{
while(j<n && sum<l)
{
sum+=v[j].first;
j++;
}
if(sum>=l && sum<=u)
{
vector<int> res;
for(int k=i; k<j; k++)
{
res.push_back(v[k].second);
}
sort(res.begin(),res.end());
return res;
}
sum-=v[i].first;
i++;
}
return {};
}
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... |