# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
849636 | Bach21 | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 344 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>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w)
{
pair<int,int> w1[w.size()+1];
for (int i=0;i<w.size();i++)
{
w1[i].first=w[i];
w1[i].second=i+1;
}
int sum=0;
vector<int> res;
sort(w1,w1+w.size());
for (int i=0,j=0;j<w.size();j++)
{
sum+=w1[j].first;
while (sum>u)
{
sum-=w1[i++].first;
}
if (sum>=l)
{
for (int k=i;k<=j;k++)
{
res.push_back(w1[k].second);
}
break;
}
}
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... |