Submission #78865

#TimeUsernameProblemLanguageResultExecution timeMemory
78865renatsjCombo (IOI18_combo)C++14
100 / 100
56 ms568 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string S,s; char c[3]; int k,i; std::string guess_sequence(int N) { c[0]='A'; c[1]='B'; c[2]='X'; k=press("AB"); if (k==0) { if (press("X")==1) {S="X"; c[2]='Y';} else {S="Y";} } else { if (k==2) {S="AB"; c[0]='Y';} else { if (press("A")==1) {S="A"; c[0]='Y';} else {S="B"; c[1]='Y';} } } i=S.length(); while (i<N-1) { k=press(S+c[0]+c[0]+S+c[0]+c[1]+S+c[0]+c[2]+S+c[1]); if (k==i+2) {S+=c[0];} else {if (k==i+1) {S+=c[1];} else {S+=c[2];}} ++i; } if (i<N) { k=press(S+c[0]); if (k==i+1) {S+=c[0];} else {if (press(S+c[1])==i+1) {S+=c[1];} else {S+=c[2];}} } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...