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>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define pb push_back
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pii>vect;
int tl = 0, tr = 0, n = w.size();
for(int i = 0; i < n; i++)
vect.pb({w[i], i});
vi res;
ll sum = 0;
while(tl < n)
{
while(tr < n && sum < (ll)(l))
{
sum += vect[tr].f;
tr++;
}
if(sum >= (ll)(l) && sum <= (ll)(u) && (ll)(u - l) >= vect[tr].f - vect[tl].f)
{
for(int i = tl; i < tr; i++)
res.pb(vect[i].s);
return res;
}
else
{
while(tl < n && sum > (ll)(u))
{
sum -= vect[tl].f;
tl++;
}
}
if(sum < (ll)(l) && tr == n)
return vector<int>(0);
}
return vector<int>(0);
}
# | 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... |