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;
#ifdef LOCAL
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
cerr<<vars<<" = ";
string delim="";
(...,(cerr<<delim<<values,delim=", "));
cerr<<"\n";
}
#else
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {}
#endif
#define pb push_back
#define sz(x) (int)(x.size())
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> inline void maxa(T& a,T b){a=max(a,b);}
template<typename T> inline void mina(T& a,T b){a=min(a,b);}
vector<int> find_subset(int l, int u, vector<int> w){
int n=sz(w);
vector<pii> W;
for(int i=0;i<n;i++)
W.pb({w[i],i});
sort(W.begin(),W.end());
ll sum=0;
int j=n+5;
vector<int> ans;
for(int i=0;i<n;i++){
if(sum+W[i].first>u){
j=i;
break;
}
sum+=W[i].first;
ans.pb(W[i].second);
}
for(int i=n-1;i>=j && n-i-1<j && sum<l;i--){
sum+=W[i].first-W[n-i-1].first;
ans[n-i-1]=W[i].second;
}
if(sum<l || sum>u)
return {};
sort(ans.begin(),ans.end());
return ans;
}
# | 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... |