# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
961218 | raspy | Detecting Molecules (IOI16_molecules) | C++14 | 39 ms | 6348 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 <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
vector<int> find_subset(int l, int u, vector<int> ww)
{
vector<pair<int, int>> w;
int ix = 0;
for (auto v : ww)
w.push_back({v, ix++});
sort(w.begin(), w.end());
ll lf = 0, rg = 0;
ll trs = 0;
while (rg <= w.size() && (lf < rg || rg == 0))
{
// cout << lf << " " << rg << " " << trs << "\n";
if (trs > (ll)u)
{
trs -= w[lf].first;
lf++;
}
else if (trs < (ll)l)
{
trs += w[rg].first;
rg++;
}
else
{
vector<int> rez;
for (int i = lf; i < rg; i++)
rez.push_back(w[i].second);
return rez;
}
}
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... |