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 X first
#define Y second
#define pb push_back
#define pii pair<int, int>
typedef long long ll;
using namespace std;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int OFF = (1 << 20);
vector<int> find_subset(int l, int u, vector<int> w) {
vector<int> sol;
vector< pair<ll, int> > v;
for (int i = 0; i < (int)w.size(); i++) {
v.push_back({w[i], i});
}
sort(v.begin(), v.end());
ll zbr = 0;
for (int i = 0; i < (int)v.size(); i++) {
zbr += v[i].X;
sol.push_back(v[i].Y);
if (zbr >= l && zbr <= u) break;
if (zbr > u) {
reverse(sol.begin(), sol.end());
zbr -= w[sol.back()];
sol.pop_back();
if (zbr < l || zbr > u) assert(0);
break;
}
}
sort(sol.begin(), sol.end());
return sol;
}
# | 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... |