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"
using namespace std;
struct node
{
int id,mark;
bool operator < (const node &b)const
{
return mark<b.mark;
}
};
bool cmp(node a,node b)
{
return a.mark<b.mark;
}
std::vector<int> find_subset(int ll, int rr, std::vector<int> w) {
int n=w.size();
vector<node> p(n);
for(int i=0;i<n;i++)
{
p[i].id=i;
p[i].mark=w[i];
}
sort(p.begin(),p.end());
int l=0,r=0;
int res=p[0].mark;
vector<bool> st(n+1,0);
st[0]=1;
while(l<=r&&l<n&&r<n)
{
if(res<ll) res+=p[++r].mark,st[r]=1;
else if(res>rr) res-=p[l++].mark,st[l-1]=0;
else
{
vector<int> t;
for(int i=0;i<n;i++)
{
if(st[i]) t.push_back(p[i].id);
}
return t;
}
}
vector<int> tt;
return tt;
}
# | 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... |