# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1260851 | antonn | Detecting Molecules (IOI16_molecules) | C++20 | 32 ms | 2888 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<int> ord(n);
iota(ord.begin(), ord.end(), 0);
sort(ord.begin(), ord.end(), [&](int x, int y) {
return w[x] < w[y];
});
int j = 0;
ll s = 0;
for (int i = 0; i < n; ++i) {
while (j < n && s < l) {
s += w[ord[j]];
++j;
}
if (l <= s && s <= u) {
vector<int> res;
for (int k = i; k < j; ++k) res.push_back(ord[k]);
return res;
}
s -= w[ord[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... |