# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
677559 | hello_there_123 | Detecting Molecules (IOI16_molecules) | C++17 | 63 ms | 8728 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;
#define ll long long
vector<int> find_subset(int l,int u,vector<int> w){
vector<pair<ll,ll> >lol;
for(ll i=0;i<w.size();i++){
lol.push_back(make_pair(w[i],i));
}
sort(lol.begin(),lol.end());
ll n = w.size();
ll 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<ll>cur;
queue<pair<int,int> >q;
for(int i=1;i<=n;i++){
ll lo = i-1;
ll hi = n-1;
ll heh = -1;
while(lo<=hi){
ll X = (lo+hi)/2;
ll 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;
ll bruh;
if(heh-i<0) bruh = 0;
else bruh = pre[heh-i];
if(pre[heh]-bruh>=l){
for(ll 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... |