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 ii pair<int,int>
#define iii tuple<int,int,int>
#define vb vector<bool>
#define vi vector<int>
#define vii vector<ii>
#define viii vector<iii>
#define pb push_back
#define eb emplace_back
#define all(v) v.begin(),v.end()
using namespace std;
vi find_subset(int l, int u, vi w) {
int n = w.size();
vii a(n);
for (int i = 0; i < n; i++) {
a[i]={w[i],i};
} sort(all(a));
int left = 0, right = 0;
int curr = 0;
while (right < n) {
curr+=a[right].first;
if (curr >= l) {
while (curr > u && left < n) {
curr-=a[left].first;
left++;
} if (l <= curr && curr <= u) {
vi ret;
for (int i = left; i <= right; i++) {
ret.eb(a[i].second);
} return ret;
} else {
right++;
}
} else {
right++;
}
}
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... |