제출 #411174

#제출 시각아이디문제언어결과실행 시간메모리
411174pliam콤보 (IOI18_combo)C++14
97 / 100
37 ms548 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string K; string a,b,c; std::string guess_sequence(int N) { //find first letter if(press("A")){ K="A"; a="B"; b="X"; c="Y"; }else if(press("B")){ K="B"; a="A"; b="X"; c="Y"; }else if(press("X")){ K="X"; a="A"; b="B"; c="Y"; }else{ K="Y"; a="A"; b="B"; c="X"; } int pos=1; while(pos<N-1){ int ans1,ans2; ans1=press(K+a+a+K+b+a+K+a+b)-K.size(); if(ans1==2){ ans2=press(K+a+a)-K.size(); if(ans2==0){ K+=(b+a); pos+=2; continue; }else if(ans2==1){ K+=(a+b); pos+=2; continue; }else{ K+=(a+a); pos+=2; continue; } }else if(ans1==1){ ans2=press(K+b+b)-K.size(); if(ans2==0){ K+=(a+c); pos+=2; continue; }else if(ans2==1){ K+=(b+c); pos+=2; continue; }else{ K+=(b+b); pos+=2; continue; } }else{ K+=c; pos++; continue; } } if(pos==N-1){ if(press(K+a)-K.size()){ K+=a; }else if(press(K+b)-K.size()){ K+=b; }else{ K+=c; } } return K; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...