# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384525 | AlexRex0 | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 384 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> res;
vector< pair<int, int> > arre;
pair<int, int> aux;
vector<int> find_subset(int l, int u, vector<int> w) {
int ini = 0, fin = 0, suma = 0;
for(int i = 0; i < w.size(); ++i){
aux.first = w[i];
aux.second = i;
arre.push_back(aux);
}
sort(arre.begin(), arre.end());
while(fin <= arre.size() && ini <= fin){
if(suma < l){
if(fin < arre.size()){
suma+= arre[fin].first;
fin++;
if(suma >= l && suma <= u){
for(int i = ini; i <= fin - 1; ++i){
res.push_back(arre[i].second);
}
break;
}
}else{
break;
}
}else{
suma-= arre[ini].first;
ini++;
}
}
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... |