# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
527030 | lcs147 | Detecting Molecules (IOI16_molecules) | C++98 | 40 ms | 2612 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"molecules.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>find_subset(int l, int r, vector<int> w) {
if(l > r) return {};
vector<int>id(w.size());
iota(id.begin(), id.end(), 0);
sort(id.begin(), id.end(), [&](int a, int b){
return w[a] < w[b];
});
int i, j, sum = 0;
for(i=0, j=0; j<id.size(); j++) {
int jj = id[j];
sum += w[jj];
while(sum > r) {
int ii = id[i];
sum -= w[ii];
i++;
}
if(sum >= l) break;
}
vector<int>res;
if(sum >= l) {
for(int x=i; x<=j; x++) {
res.push_back(id[x]);
}
}
sort(res.begin(), res.end());
return res;
}
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... |