제출 #713238

#제출 시각아이디문제언어결과실행 시간메모리
713238ooo콤보 (IOI18_combo)C++14
100 / 100
37 ms596 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string s = ""; if(press("AB")) { if(press("A")) s += 'A'; else s += 'B'; } else { if(press("X")) s += 'X'; else s += 'Y'; } string thua = ""; if(s[0] != 'A') thua += 'A'; if(s[0] != 'B') thua += 'B'; if(s[0] != 'X') thua += 'X'; if(s[0] != 'Y') thua += 'Y'; int len = int(s.size()); while(len < n-1) { string temp = s+thua[0]+s+thua[1]+thua[0]+s+thua[1]+thua[2]+s+thua[1]+thua[1]; int x = press(temp); if(x == len) s += thua[2]; else if(x == len+1) s += thua[0]; else s += thua[1]; len = int(s.size()); } if(len == n) return s; if(press(s+thua[0]) == n) return s+thua[0]; if(press(s+thua[1]) == n) return s+thua[1]; return s+thua[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...