# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70174 | Vahan | Detecting Molecules (IOI16_molecules) | C++17 | 4 ms | 632 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<algorithm>
#include<vector>
using namespace std;
vector<int> g1,g2;
vector<pair<int,int> > v;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
for(int i=0;i<w.size();i++)
v.push_back({w[i],i});
sort(v.begin(),v.end());
long long s=0;
for(int i=0;i<v.size();i++)
{
s+=v[i].first;
g1.push_back(v[i].second);
if(s>=l && s<=u)
return g1;
if(s>u)
break;
}
s=0;
for(int i=v.size()-1;i>=0;i--)
{
s+=v[i].first;
g2.push_back(v[i].second);
if(s>=l && s<=u)
return g2;
if(s>u)
break;
}
return std::vector<int>(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... |