# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
331023 | Drew_ | Detecting Molecules (IOI16_molecules) | C++14 | 62 ms | 6240 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;
#define ll long long
#define ii pair<int,int>
#define pb push_back
#define f1 first
#define s2 second
vector<int> find_subset(int l, int u, vector<int> w) {
vector<ii> v;
for (int i = 0; i < w.size(); ++i)
{
if (w[i] > u) continue;
else if (l <= w[i] && w[i] <= u)
{
vector<int> res;
res.pb(i);
return res;
}
else
{
v.pb({w[i], i});
}
}
sort(v.begin(), v.end());
queue<ii> q;
ll val = 0;
for (ii x : v)
{
val += x.f1;
q.push(x);
while (!q.empty() && val > u)
{
val -= q.front().f1;
q.pop();
}
if (l <= val && val <= u)
{
vector<int> res;
while (!q.empty())
res.pb(q.front().s2), q.pop();
return res;
}
}
return 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... |