# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1187030 | eri16 | Detecting Molecules (IOI16_molecules) | C++20 | 36 ms | 4132 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<pair<int, int>> k;
for (int i = 0; i < n; ++i) {
k.push_back({w[i], i});
}
sort(k.begin(), k.end());
int left = 0, right = 0;
long long sum = 0;
while (right < n) {
sum += k[right].first;
while (sum > u && left <= right) {
sum -= k[left].first;
left++;
}
if (sum >= l && sum <= u) {
vector<int> result;
for (int i = left; i <= right; ++i) {
result.push_back(k[i].second);
}
return result;
}
right++;
}
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... |