# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
639969 | rc_catunta | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 216 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 <vector>
#include <algorithm>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
// Desempaquetar en un vector de pairs
vector< pair<int,int> > v;
for(int i=0;i<w.size();i++){
v.push_back(make_pair(w[i],i));
}
sort(v.begin(),v.end());
vector<int> res;
int suma = 0;
// Probemos de menor a mayor
for(int i=0;i<v.size();i++){
suma += v[i].first;
res.push_back(v[i].second);
if(suma>=l and suma<=u) return res;
}
suma = 0;
res.clear();
for(int i=v.size()-1;i>=0;i--){
suma += v[i].first;
res.push_back(v[i].second);
if(suma>=l and suma<=u) return res;
}
res.clear();
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... |