제출 #1006329

#제출 시각아이디문제언어결과실행 시간메모리
1006329inesfiDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms428 KiB
#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; } trouve=0; sommeec=sommepetit; while (sommeec<debrep){ sommeec-=poids[ec].first; ec++; sommeec+=poids[ec+nb].first; } for (int i=0;i<ec;i++){ rep.push_back(poids[i+ec].second); } return rep; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...