# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
600441 | A_D | Detecting Molecules (IOI16_molecules) | C++14 | 115 ms | 14688 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;
vector<int> find_subset(int l, int u, vector<int> w) {
set<int> st;
vector<int> vec;
int n=w.size();
vector<pair<int,int>> s;
for(int i=0;i<w.size();i++){
s.push_back({w[i],i});
}
sort(s.begin(),s.end());
if(s[0].first>u)return vec;
int sum=0,l1=0,r1=-1;
while(r1<n){
if(l<=sum&&sum<=u)break;
if(sum<l){
r1++;
if(r1==n)break;
sum+=s[r1].first;
st.insert(s[r1].second);
}
else{
st.erase(s[l1].second);
sum-=s[l1].first;
l1++;
}
}
for(auto x:st)vec.push_back(x);
if(sum<l||sum>u){
vec.clear();
}
sort(vec.begin(),vec.end());
return vec;
}
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... |