# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
526315 | Belgutei | Detecting Molecules (IOI16_molecules) | C++17 | 53 ms | 7068 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;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
vector<int> v;
vector<pair<int,int> > w;
std::vector<int> find_subset(int l, int u, std::vector<int> W) {
ll tot=0;
ll pos=-1;
for(int i=0; i<W.size(); i++){
w.pb(mk(W[i],i));
}
sort(w.begin(),w.end());
/*
for(int i=0; i<w.size(); i++){
cout<<w[i].ff<<" "<<w[i].ss<<'\n';
}
cout<<"\n";
*/
for(int i=0; i<w.size(); i++){
if(tot+w[i].ff<=u){
v.pb(w[i].ss);
tot+=w[i].ff;
}
else{
pos=i;
break;
}
}
if(l<=tot && tot<=u) return v;
if(pos==-1){
v.clear();
return v;
}
//cout<<pos<<"\n";
int ehlel=0;
for(int i=pos; i<w.size(); i++){
//cout<<w[i].ff<<" "<<w[ehlel].ff<<"\n";
//cout<<i<<" "<<w[ehlel].ss<<"\n\n";
tot+=w[i].ff;
v.pb(w[i].ss);
tot-=w[ehlel].ff;
ehlel++;
if(tot>=l) break;
}
vector<int> ans;
ans.clear();
if(l<=tot && tot<=u){
for(int i=ehlel; i<v.size(); i++){
ans.pb(v[i]);
}
}
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... |