# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
483378 | DavidDamian | Detecting Molecules (IOI16_molecules) | C++11 | 1 ms | 296 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) {
vector< pair<int, int> > elements;
for(int i = 0; i < w.size(); i++){
elements.push_back({w[i], i});
}
sort(elements.begin(), elements.end());
vector<int> indices;
int sumEl = 0, i = 0, j = 0;
while(j < elements.size()){
if(sumEl < l){
// if (j == elements.size() - 1) break;
sumEl+=elements[j++].first;
}else if(sumEl > r){
sumEl-=elements[i++].first;
}
if(sumEl >= l && sumEl <= r)
break;
}
if(sumEl >= l && sumEl <=r){
while(i<j)
indices.push_back(elements[i++].second);
}
return indices;
}
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... |