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"
#define all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
const int inf = 1e9 + 10000;
const int mod = 1e9+7;
const int maxn = 5e5 + 12;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vi ans;
int s = 0, j = 0;
pair<int, int> p[n];
for(auto i : w) {
p[j] = {i, j};
j++;
}
sort(p, p + n);
j = 0;
if(p[0].ff > u)return ans;
if(p[0].ff >= l)return {p[0].ss};
for(int i = n - 1; i > 0; i--) {
ans.pb(p[i].ss);
s += p[i].ff;
if(s > u)break;
if(s >= l)return ans;
if(s + p[0].ff <= u && s + p[0].ff >= l){
ans.pb(p[0].ss);
return ans;
}
}
return vi(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... |