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 F first
#define S second
#define pii pair<ll, ll>
const ll mod = 1e9 + 7;
const ll mxN = 1e6 + 5;
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w)
{
sort(w.begin(), w.end());
int n = w.size();
int R = n - 1;
ll num = 0;
vector<int> ans;
for (int i = n - 1; i >= 0; i--)
{
if (num >= l && num <= u)
{
for (int j = i + 1; j <= R; j++)
ans.push_back(j);
return ans;
}
if (num > u)
{
num -= w[R];
R--;
}
if (num >= l && num <= u)
{
for (int j = i + 1; j <= R; j++)
ans.push_back(j);
return ans;
}
num += w[i];
if (num >= l && num <= u)
{
cout << i << ' ' << R << '\n';
for (int j = i; j <= R; j++)
ans.push_back(j);
return ans;
}
}
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... |