Submission #1129936

#TimeUsernameProblemLanguageResultExecution timeMemory
1129936pedreitorzeldaCombo (IOI18_combo)C++20
100 / 100
10 ms484 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N){ string ans = ""; vector<char>possible = {'A','B','X','Y'}; vector<char>npossible = {'A','B','X','Y'}; for(int i=0;i<N;i++){ if(i==N-1){ string q = ""; q+=ans+npossible[0]; q+=ans+npossible[1]; int tmp = press(q); if(tmp==N){ q=ans+npossible[0]; tmp = press(q); if(tmp==N)ans+=npossible[0]; else ans+=npossible[1]; }else{ if(npossible.size()==3)ans+=npossible[2]; else{ q=ans+npossible[2]; tmp = press(q); if(tmp==N)ans+=npossible[2]; else ans+=npossible[3]; } } }else if(i==0){ string q = ""; q+=(possible[0]); q+=(possible[1]); int tmp = press(q); if(tmp>=1){ q = possible[0]; tmp = press(q); if(tmp==1)ans+=possible[0]; else ans+=possible[1]; }else{ q = possible[2]; tmp = press(q); if(tmp==1)ans+=possible[2]; else ans+=possible[3]; }npossible.clear(); for(int j=0;j<4;j++){ if(possible[j]!=ans[0])npossible.push_back(possible[j]); } }else{ string q = ""; q+=ans+npossible[0]; for(int j=0;j<3;j++){ q+=ans; q+=npossible[1]; q+=npossible[j]; }int tmp = press(q); if(tmp==i+1){ ans+=npossible[0]; }else if(tmp==i+2){ ans+=npossible[1]; }else{ ans+=npossible[2]; } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...