제출 #124734

#제출 시각아이디문제언어결과실행 시간메모리
124734dragonslayerit콤보 (IOI18_combo)C++14
100 / 100
44 ms536 KiB
#include "combo.h" #include <iostream> std::string guess_sequence(int N) { char keys[4]={'A','B','X','Y'}; int first=-1; if(press("AB")>0){ if(press("A")>0){ first=0; }else{ first=1; } }else{ if(press("X")>0){ first=2; }else{ first=3; } } std::string str(1,keys[first]); if(N==1) return str; for(int i=1;i<N-1;++i) { int score=press(str+keys[first^2]+ str+keys[first^3]+keys[first^1]+ str+keys[first^3]+keys[first^2]+ str+keys[first^3]+keys[first^3])-i; switch(score){ case 0:str+=keys[first^1];break; case 1:str+=keys[first^2];break; case 2:str+=keys[first^3];break; } } if(press(str+keys[first^1])==N){ return str+keys[first^1]; } if(press(str+keys[first^2])==N){ return str+keys[first^2]; } return str+keys[first^3]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...