# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1040699 | LaMatematica14 | Detecting Molecules (IOI16_molecules) | C++17 | 77 ms | 18420 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 <bits/stdc++.h>
using namespace std;
vector<int> fine(multimap<long long, int> a) {
vector<int> r(a.size()); int n = 0;
for(pair<int, int> i : a) r[n++] = i.second;
return r;
}
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<long long, int>> wn(w.size());
for (int i = 0; i < w.size(); i++) wn[i] = {w[i], i};
sort(wn.begin(), wn.end());
multimap<long long, int> in;
long long tot = 0, larg = 0;
for (int i = 0; i < wn.size() && tot+wn[i].first <= u; i++) {
tot += wn[i].first; in.insert(wn[i]);
if (tot >= l) return fine(in);
larg = i;
}
for (int i = larg+1; i < wn.size() && tot < l; i++) {
if (in.lower_bound(tot+wn[i].first-(long long)u) != in.end()) {
long long aus = tot;
tot -= (*in.lower_bound(tot+wn[i].first-(long long)u)).first;
tot += wn[i].first;
in.erase(in.lower_bound(aus+wn[i].first-(long long)u));
in.insert(wn[i]);
}
if (tot >= l) return fine(in);
}
vector<int> a(0);
return a;
}
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... |