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 <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int inf, int sup, vector<int> Tailles) {
vector <pair <int, int>> Molecules;
int nbMolecules = 0;
for (int a : Tailles)
{
Molecules.push_back({a, nbMolecules ++});
}
sort(Molecules.begin(), Molecules.end());
int sum = 0;
int gauche = 0, droite = 0;
while (droite < nbMolecules && sum + Molecules[droite].first <= sup)
{
sum += Molecules[droite ++].first;
}
while (droite < nbMolecules && sum < inf)
{
sum += Molecules[droite ++].first - Molecules[gauche ++].first;
}
if (droite == nbMolecules && sum < inf)
return vector<int>(0);
vector <int> ans;
for (int i = gauche; i < droite; i ++)
{
ans.push_back(Molecules[i].second);
}
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... |