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 ll long long
#define str string
#define ins insert
#define ld long double
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz size()
#define vll vector<int>
#define bc back()
#define arr array
#define pll vector<pair<ll,ll>>
using namespace std;/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>*/
template<class S,class T>
bool chmin(S &a,const T &b) {
return a>b?(a=b)==b:false;
}
template<class S,class T>
bool chmax(S &a,const T &b) {
return a<b?(a=b)==b:false;
}
vector<int> find_subset(int L, int U, vector<int> W) {
ll l=L,u=U;
ll i,j;
ll n=W.sz;
ll sum=0;
vll v;
pll w;
for(i=0;i<n;i++)w.pb({W[i],i});
sort(all(w));
if(w[0].fr>u)return v;
ll x=n;
for(i=0;i<n;i++){
if(sum+w[i].fr<l)sum+=w[i].fr;
else {
if(sum+w[i].fr<=u){
for(j=0;j<=i;j++){
v.pb(w[j].sc);
}
return v;
}
x=i;
break;
}
}
for(i=0;i<x;i++){
if(n-i-1<x)return v;
sum-=w[i].fr;
sum+=w[n-i-1].fr;
if(sum>=l && sum<=u){
for(j=i+1;j<x;j++) v.pb(w[j].sc);
for(j=0;j<=i;j++) v.pb(w[n-j-1].sc);
return v;
}
}
return {};
}
# | 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... |