이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
int sommepetit,sommegrand,trouve,nb,sommeec,ec;
vector<int> rep;
vector<pair<int,int>> poids;
vector<int> find_subset(int debrep, int finrep,vector<int> p) {
for (int i=0;i<(int)p.size();i++){
poids.push_back(make_pair(p[i],i));
}
sort(poids.begin(),poids.end());
for (int i=0;i<(int)poids.size();i++){
if (trouve==0){
sommepetit+=poids[i].first;
sommegrand+=poids[poids.size()-i-1].first;
if (sommepetit<debrep and sommegrand>finrep){
nb=i;
trouve=1;
}
if (sommepetit>=debrep and sommepetit<=finrep){
for (int j=0;j<=i;j++){
rep.push_back(poids[j].second);
}
return rep;
}
if (sommegrand>=debrep and sommegrand<=finrep){
for (int j=0;j<=i;j++){
rep.push_back(poids[poids.size()-j-1].second);
}
return rep;
}
}
}
if (trouve==0){
return rep;
}
sommeec=sommepetit;
while (sommeec<debrep){
sommeec-=poids[ec].first;
ec++;
sommeec+=poids[ec+nb].first;
}
for (int i=0;i<=nb;i++){
rep.push_back(poids[i+ec].second);
}
return rep;
}
# | 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... |