# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1187038 | orgiloogii | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
long long n = w.size();
vector <pair <long long, long long>> p;
p.push_back({0, 0});
for (long long i = 0;i < n;i++) {
p.push_back({w[i], i});
}
sort(p.begin(), p.end());
vector <int> res;
int l1 = 1, r = 1;
long long suml = 0, summer = 0;
long long sum = 0;
while (r <= n && l1 <= n) {
while (sum < l) {
sum += p[r].first;
r++;
}
while (sum > u) {
sum -= p[l1].first;
l1++;
}
if (sum <= u && sum >= l) {
while (l1 < r) {
res.push_back(p[l1].second);
l1++;
}
return res;
}
}
return res;
}
//signed main() {
//}
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... |