# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1226803 | Jer | Detecting Molecules (IOI16_molecules) | C++20 | 35 ms | 4024 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
int n;
std::vector<int> find_subset(int l, int u, std::vector<int> w)
{
n = w.size();
vector<pair<int, int>> a;
for (int i = 0; i < n; i++)
a.push_back({w[i], i});
sort(a.begin(), a.end());
int i = 0, sum = 0;
for (int j = 0; j < n; j++)
{
sum += a[j].first;
while (sum > u)
sum -= a[i].first, i++;
if (sum >= l and sum <= u)
{
vector<int> res;
for (int x = i; x <= j; x++)
res.push_back(a[x].second);
return res;
}
}
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... |