# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384516 | AlexRex0 | Detecting Molecules (IOI16_molecules) | C++14 | 2 ms | 496 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;
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){
arre[i].first = w[i];
arre[i].second = i;
}
sort(arre.begin(), arre.end());
bool encontre = false;
while(fin <= arre.size()){
if(suma < l){
suma+= arre[fin].first;
fin++;
if(suma >= l && suma <= u){
int ind = 0;
for(int i = ini; i <= fin - 1; ++i){
res[ind] = arre[i].second;
ind++;
}
encontre = true;
break;
}
}else{
suma-= arre[ini].first;
ini++;
}
}
if(encontre){
return res;
}else{
fin--;
while(ini <= fin){
suma-= arre[ini].first;
ini++;
if(suma >= l && suma <= u){
int ind = 0;
for(int i = ini; i <= fin; ++i){
res[ind] = arre[i].second;
ind++;
}
break;
}
}
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... |