# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
883100 | Husayn | Detecting Molecules (IOI16_molecules) | C++14 | 128 ms | 27480 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>
typedef long long ll;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int n = (int) w.size();
std::vector<std::pair<int, int>> a(n);
for (int i = 0; i < n; i++) {
a[i] = {w[i], i};
}
std::sort(a.begin(), a.end());
std::set<ll> st;
std::map<ll, int> pos;
ll s = 0;
st.insert(0);
pos[0] = -1;
for (int i = 0; i < n; i++) {
auto [value, idx] = a[i];
s += value;
auto it = *st.lower_bound(s - u);
if (it <= s - l) {
std::vector<int> ret;
for (int j = pos[it] + 1; j <= i; j++) {
ret.push_back(a[j].second);
}
return ret;
}
st.insert(s);
pos[s] = i;
}
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... |