제출 #820099

#제출 시각아이디문제언어결과실행 시간메모리
820099oscar1f버섯 세기 (IOI20_mushrooms)C++17
80.71 / 100
8 ms464 KiB
#include<bits/stdc++.h> #include "mushrooms.h" using namespace std; int nbVal,idCour,nbA,ans,taille; vector<int> listeA,listeB; vector<int> quest; int count_mushrooms(int n) { nbVal=n; idCour=1; nbA=1; listeA.push_back(0); while (idCour<nbVal) { quest.clear(); if (listeA.size()>=listeB.size()) { for (int i=0;i<(int)listeA.size();i++) { if (idCour<nbVal) { quest.push_back(listeA[i]); quest.push_back(idCour); idCour++; } } ans=use_machine(quest); if (ans%2==0) { listeA.push_back(quest.back()); } else { listeB.push_back(quest.back()); } taille=quest.size()/2; ans=(ans+1)/2; nbA+=taille-ans; } else { for (int i=0;i<(int)listeB.size();i++) { if (idCour<nbVal) { quest.push_back(listeB[i]); quest.push_back(idCour); idCour++; } } ans=use_machine(quest); if (ans%2==1) { listeA.push_back(quest.back()); } else { listeB.push_back(quest.back()); } taille=quest.size()/2; ans=(ans+1)/2; nbA+=ans; } } return nbA; }
#Verdict Execution timeMemoryGrader output
Fetching results...