# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
706458 | finn__ | Detecting Molecules (IOI16_molecules) | C++17 | 55 ms | 6208 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;
vector<int> find_subset(int l, int u, vector<int> w)
{
vector<pair<int, int>> y;
for (int i = 0; i < w.size(); i++)
y.emplace_back(w[i], i);
sort(y.begin(), y.end());
sort(w.begin(), w.end());
auto it = w.begin(), jt = w.begin();
long long x = 0;
while (1)
{
if (x < l)
{
if (jt == w.end())
return {};
x += *jt++;
}
else if (x > u)
x -= *it++;
else
{
vector<int> ans;
for (size_t i = it - w.begin(); i < jt - w.begin(); i++)
ans.push_back(y[i].second);
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... |