# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305925 | kylych03 | Detecting Molecules (IOI16_molecules) | C++14 | 77 ms | 5240 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>
//#include "grader.cpp"
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector <int> res;
vector <long long> pr;
vector <pair<int, int> > a;
a.resize(w.size());
pr.resize(w.size()+1);
for(int i = 0 ; i < w.size(); i++){
a[i].first = w[i];
a[i].second = i;
}
sort(a.begin(), a.end());
pr[0]=0;
for(int i = 0 ; i < w.size(); i++){
pr[i+1] =pr[i] + a[i].first;
}
int cnt=0;
for(int i=1;i<=a.size(); i++){
if(pr[i] - pr[cnt] > u ){
cnt++;
}
if(pr[i] - pr[cnt] <= u && pr[i] - pr[cnt]>=l){
for(int j = cnt;j<i; j++ )
res.push_back(a[j].second);
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... |