# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
677557 | hello_there_123 | Detecting Molecules (IOI16_molecules) | C++17 | 49 ms | 5832 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 <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l,int u,vector<int> w){
vector<pair<int,int> >lol;
for(int i=0;i<w.size();i++){
lol.push_back(make_pair(w[i],i));
}
sort(lol.begin(),lol.end());
int n = w.size();
int pre[n+3];
for(int i=0;i<n;i++){
if(i==0) pre[i] = lol[i].first;
else pre[i] = lol[i].first+pre[i-1];
}
vector<int>ans;
vector<int>cur;
queue<pair<int,int> >q;
for(int i=1;i<=n;i++){
int lo = i-1;
int hi = n-1;
int heh = -1;
while(lo<=hi){
int X = (lo+hi)/2;
int bruh;
if(X-i<0) bruh = 0;
else bruh = pre[X-i];
if(pre[X]-bruh<=u){
heh = X;
lo = X+1;
}
else hi = X-1;
}
if(heh == -1) continue;
int bruh;
if(heh-i<0) bruh = 0;
else bruh = pre[heh-i];
if(pre[heh]-bruh>=l){
for(int j=heh;j>=heh-i+1;j--){
ans.push_back(lol[j].second);
}
return ans;
}
}
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... |