제출 #1142291

#제출 시각아이디문제언어결과실행 시간메모리
1142291huutuan콤보 (IOI18_combo)C++20
100 / 100
7 ms484 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { char a, b, x, y; a='A', b='B', x='X', y='Y'; if (press("AB")){ if (press("A")); else swap(a, b); }else{ if (press("X")) swap(a, x); else swap(a, y); } string ans(1, a); while ((int)ans.size()+2<=N){ string guess=ans+x+ans+y+b+ans+y+x+ans+y+y; int t=press(guess)-(int)ans.size(); if (t==0) ans.push_back(b); else if (t==1) ans.push_back(x); else ans.push_back(y); } if ((int)ans.size()!=N){ if (press(ans+b)==N) ans.push_back(b); else if (press(ans+x)==N) ans.push_back(x); else ans.push_back(y); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...