# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23995 | gs14004 | Detecting Molecules (IOI16_molecules) | C++11 | 83 ms | 5424 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;
typedef pair<int, int> pi;
typedef long long lint;
int n;
pi elem[200005];
vector<int> find_subset(int l, int u, vector<int> w) {
n = w.size();
for(int i=0; i<n; i++) elem[i] = pi(w[i], i);
sort(elem, elem + n);
lint e = 0, sum = 0;
for(int i=0; i<n; i++){
while(e < n && sum < l){
sum += elem[e++].first;
}
if(sum >= l && sum <= u){
vector<int> r;
for(int j=i; j<e; j++) r.push_back(elem[j].second);
sort(r.begin(), r.end());
return r;
}
sum -= elem[i].first;
}
return vector<int>();
}
# | 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... |