# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
632517 | Stavab | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 288 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 <utility>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w)
{
vector<pair<int, int>> v;
for(int i = 0; i < w.size(); i++)
v.push_back(make_pair(w[i], i));
sort(w.begin(), w.end());
long long sum = 0;
int i, j = 0;
for(i = 0; i < w.size(); i++)
{
sum += (long long)v[i].first;
while(sum > u)
{
sum -= v[j].first;
j++;
}
if(l <= sum && sum <= u)
break;
}
if(i == w.size())
return {};
vector<int> ind;
for(int z = j; z <= i; z++)
ind.push_back(v[z].second);
return ind;
}
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... |