Submission #429635

#TimeUsernameProblemLanguageResultExecution timeMemory
429635TLP39Combo (IOI18_combo)C++14
100 / 100
49 ms532 KiB
#include "combo.h" char c[4]={'A','B','X','Y'}; int st; std::string guess_sequence(int N) { std::string s = ""; int temp; temp=press("AB"); if(temp) { if(press("A")) {s+="A"; st=0;} else {s+="B"; st=1;} } else { if(press("X")) {s+="X"; st=2;} else {s+="Y"; st=3;} } if(N==1) return s; std:: string test=""; for(int i=1;i<N-1;i++) { test.clear(); test+=s; test.push_back(c[(st+1)%4]); test.push_back(c[(st+1)%4]); test+=s; test.push_back(c[(st+1)%4]); test.push_back(c[(st+2)%4]); test+=s; test.push_back(c[(st+1)%4]); test.push_back(c[(st+3)%4]); test+=s; test.push_back(c[(st+2)%4]); temp=press(test)-i; if(temp==2) s.push_back(c[(st+1)%4]); else if(temp==1) s.push_back(c[(st+2)%4]); else s.push_back(c[(st+3)%4]); } for(int i=1;i<=2;i++) { s.push_back(c[(st+i)%4]); if(press(s)==N) return s; s.pop_back(); } s.push_back(c[(st+3)%4]); return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...