# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82871 | SecretAgent007 | Detecting Molecules (IOI16_molecules) | C++17 | 88 ms | 13204 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> find_subset(int l, int r, vector<int> w){
int n = w.size();
vector< pair<int, int> > toS(0);
for(int i = 0; i < w.size(); i++){
toS.push_back(make_pair(w[i],i));
}
sort(toS.begin(), toS.end());
int le = 0;
int ri = 0;
long long sum = 0;
while(1){
while(ri < n && sum < l){
sum+=toS[ri++].first;
}
while(le < n && sum > r){
sum-=toS[le++].first;
}
if(sum >= l && sum <= r){
vector<int> ans(0);
for(int i = le; i < ri; i++){
ans.push_back(toS[i].second);
}
return ans;
}
if(le >= n || ri >= n) break;
}
vector<int> ans(0);
return ans;
}
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... |