제출 #446050

#제출 시각아이디문제언어결과실행 시간메모리
446050cs71107콤보 (IOI18_combo)C++14
100 / 100
45 ms648 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char val[10]; std::string guess_sequence(int N) { string AB = "AB"; string AX = "AX"; int ab = press(AB); int ax = press(AX); string ans = ""; if(ab&&ax){ ans = "A"; val[0] = 'B'; val[1] = 'X'; val[2] = 'Y'; } else if(ab){ ans = "B"; val[0] = 'A'; val[1] = 'X'; val[2] = 'Y'; } else if(ax){ ans = "X"; val[0] = 'A'; val[1] = 'B'; val[2] = 'Y'; } else { ans = "Y"; val[0] = 'A'; val[1] = 'B'; val[2] = 'X'; } if(N==1){ return ans; } string tz = ""; string to = ""; string tt = ""; string oz = ""; tz += val[2]; tz += val[0]; to += val[2]; to += val[1]; tt += val[2]; tt += val[2]; oz += val[1]; for(int i=1;i<N-1;i++){ string curs = ans+tz; curs+=(ans+to); curs+=(ans+tt); curs+=(ans+oz); int curv = press(curs); assert(curv<=i+2); ans+=val[curv-i]; } string ansz = ans+val[0]; string anso = ans+val[1]; if(press(ansz)==N){ ans+=val[0]; } else if(press(anso)==N){ ans+=val[1]; } else { ans+=val[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...