# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
730786 | ETheBest3 | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 340 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>
#include "molecules.h"
#define lli int
using namespace std;
vector<lli> ans, otg;
vector<pair<lli, lli>> W;
lli N;
bool used[200005];
void to_otg(){
for(lli i=0; i<ans.size(); i++){
otg.push_back(W[ans[i]].second);
}
return;
}
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
for(lli i=0; i<w.size(); i++)W.push_back({w[i], i});
sort(W.begin(), W.end());
N=W.size();
lli p1=0, p2=0, sum=0;
while(sum<=l and p2<N){
if(sum+W[p2].first>l)break;
sum+=W[p2].first;
ans.push_back(p2);
p2++;
}
if(sum==l){
to_otg();
return otg;
}
if(p2<N and sum+W[p2].first>=l and sum+W[p2].first<=u){
ans.push_back(p2);
to_otg();
return otg;
}
if(ans.size()==0)return vector<int>(0);
while(p2<N){
sum+=W[p2].first-W[p1].first;
ans[p1]=p2;
if(sum>=l and sum<=u)break;
p1++;
p2++;
}
if(sum<l or sum>u)return vector<int>(0);
to_otg();
return otg;
}
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... |