# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
957336 | Alexabcde1 | Detecting Molecules (IOI16_molecules) | C++14 | 1058 ms | 348 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>
#define f first
#define s second
using namespace std;
long long ll,rr;
vector<pair<long long,long long> > ve;
vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<int> ans;
for (int i=0;i<w.size();i++){
ve.push_back({w[i],i});
}
sort(ve.begin(),ve.end());
for (int i=1;i<w.size();i++) ve[i].f+=ve[i-1].f;
ll=0; rr=0;
while (rr<w.size()){
long long sum=ve[rr].f;
if (ll!=0) sum-=ve[ll-1].f;
if (l<=sum && sum<=u){
for (int ii=ll;ii<=rr;ii++) ans.push_back(ve[ii].s);
sort(ans.begin(),ans.end());
return ans;
}
else if (sum<l) rr++;
else {
ll++;
if (rr<ll) ll=rr;
}
}
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... |