Submission #1236990

#TimeUsernameProblemLanguageResultExecution timeMemory
1236990pcpCombo (IOI18_combo)C++20
100 / 100
7 ms488 KiB
#include "combo.h" #include <iostream> #include <string> #include <vector> using namespace std; std::string guess_sequence(int N) { std::string p = ""; string lts = "ABXY"; string l=""; string lt=""; if (press("AB")){ p = (press("A")) ? "A" : "B"; }else { p = (press("X")) ? "X" : "Y"; } for (char x : lts){ if (x==p.back())continue; if ((int)lt.size()==2)l+=x; else{ lt+=x; } } while ((int)p.size() < N){ if (p.size()==N-1){ if (press(p+lt[0])==N)p+=lt[0]; else if (press(p+lt[1])==N)p+=lt[1]; else p+=l; } else{ string juan = p+lt[0]+lt[1] +p+lt[0]+l +p+lt[0]+lt[0] +p+lt[1]; int rslt=press(juan); if (rslt == (int)p.size())p+=l; else if (rslt==(int)p.size()+1) p+=lt[1]; else p+=lt[0]; } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...