제출 #936972

#제출 시각아이디문제언어결과실행 시간메모리
936972MuntherCarrot콤보 (IOI18_combo)C++14
100 / 100
14 ms1916 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; // int press(string s) string s = "ABXY"; string guess_sequence(int N){ if(N == 1){ if(press("A")){ return "A"; } else if(press("B")){ return "B"; } else if(press("X")){ return "X"; } else return "Y"; } string ans; if(press("AB")){ if(press("B")) swap(s[0], s[1]); } else{ if(press("X")) swap(s[0], s[2]); else swap(s[0], s[3]); } ans = s[0]; while((int)ans.size() < N - 1){ string f = ans + s[1] + ans + s[2] + s[1] + ans + s[2] + s[2] + ans + s[2] + s[3]; int res = press(f); if(res == (int)ans.size()){ ans += s[3]; } else if(res == (int)ans.size() + 1){ ans += s[1]; } else{ ans += s[2]; } } if(press(ans + s[1]) == N) ans += s[1]; else if(press(ans + s[2]) == N) ans += s[2]; else ans += s[3]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...