# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
380449 | saarang123 | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int l, int r, vector<int> w) {
using ll = long long;
vector<array<ll, 2>> a;
for(int i = 0; i < w.size(); i++)
a.push_back({w[i], i + 1});
sort(a.begin(), a.end());
vector<int> ans;
int j = 0, n = a.size();
ll sum = 0;
for(int i = 0; i < n; i++) {
while(j < n && sum < l)
sum += a[j++][0];
if(l <= sum && sum <= r) {
for(int k = i; k < j; k++)
ans.push_back(a[k][1]);
return ans;
}
sum -= a[i][0];
}
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... |