# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
612029 | boris_mihov | Detecting Molecules (IOI16_molecules) | C++14 | 63 ms | 4764 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 <numeric>
typedef long long llong;
const int MAXN = 200000 + 10;
int perm[MAXN], n;
std::vector <int> find_subset(int l, int u, std::vector <int> w)
{
n = w.size();
std::iota(perm+1, perm+1+n, 0);
std::sort(perm+1, perm+1+n, [&](int x, int y)
{
return w[x] < w[y];
});
std::sort(w.begin(), w.end());
int lp = 1;
llong sum = 0;
for (int rp = 1 ; rp <= w.size() ; ++rp)
{
sum += w[rp - 1];
while (sum > u) sum -= w[lp++ - 1];
if (l <= sum && sum <= u)
{
std::vector <int> ans;
for (int j = lp ; j <= rp ; ++j)
{
ans.push_back(perm[j]);
}
return ans;
}
}
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... |