이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |