# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1124882 | sinatbtfard | Detecting Molecules (IOI16_molecules) | C++20 | 44 ms | 3656 KiB |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector <int> find_subset (int l, int r, vector <int> w){
ll sum = 0, n = w.size();
vector <pair <int, int>> a(n);
for (int i = 0; i < n; i++)
a[i] = {w[i], i},
sum += w[i];
sort(a.begin(), a.end());
vector <int> ans;
sum = a[0].first;
for (int i = 0, j = 0; j < n;){
if (sum < l)
sum += a[++j].first;
else if (sum > r)
sum -= a[i++].first;
else{
for (int k = i; k <= j; k++)
ans.push_back(a[k].second);
return ans;
}
}
return ans;
}
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... |