제출 #991270

#제출 시각아이디문제언어결과실행 시간메모리
991270coolboy19521콤보 (IOI18_combo)C++17
100 / 100
21 ms1900 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { int a = press("AB"); string p = ""; if (a) { a = press("A"); if (a) { p += 'A'; } else { p += 'B'; } } else { a = press("X"); if (a) { p += 'X'; } else { p += 'Y'; } } if (1 == N) { return p; } vector <char> chr = {'A','B','X','Y'}; chr.erase(find(begin(chr),end(chr),p[0])); while ((int)p.size()<N-1) { a = press(p + chr[0] + p + chr[1] + chr[0] + p + chr[1] + chr[2] + p + chr[1] + chr[1]); if ((int)p.size() == a) { p += chr[2]; } else if ((int)p.size()+1 == a) { p += chr[0]; } else { p += chr[1]; } } a = press(p+chr[0]+p+chr[1]); if (a==N) { a = press(p+chr[0]); if(a==N) { p += chr[0]; }else{ p += chr[1]; } } else { p += chr[2]; } // cout <<p<<'\n'; return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...