# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1131391 | tuongll | Detecting Molecules (IOI16_molecules) | C++20 | 47 ms | 4128 KiB |
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int L, int R, vector<int> w){
int n = (int)w.size();
vector<pair<int, int>> a;
for (int i = 0; i < n; ++i)
a.emplace_back(w[i], i);
sort(begin(a), end(a));
long long s = 0;
for (int i = 0, j = 0; i < n; ++i){
s += a[i].first;
while(s > R) s -= a[j++].first;
if (s >= L){
vector<int> res;
for (int k = j; k <= i; ++k)
res.push_back(a[k].second);
return res;
}
}
return vector<int>{};
}
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... |