제출 #296950

#제출 시각아이디문제언어결과실행 시간메모리
296950AMO5콤보 (IOI18_combo)C++17
100 / 100
34 ms780 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define ii pair<int,int> #define fi first #define se second #define ll long long #define all(x) x.begin(),x.end() #define sz(x) (int)x.size() const int mxn = 1e5; /* int press(string s){ cout<<s<<"\n"; int x; cin>>x; return x; } // */ string guess_sequence(int N) { string s = "", left = ""; int ptr = 0; int ask1 = press("AX"); int ask2 = press("BX"); if(ask1==ask2){ if(ask1==0)s="Y",left="ABX"; else s="X",left="ABY"; }else{ if(ask1)s="A",left="BXY"; else s="B",left="AXY"; } ptr++; if(N==1)return s; while(ptr<N-1){ string now = (s+left[0])+(s+left[1]+left[0])+(s+left[1]+left[1])+(s+left[1]+left[2]); int ask = press(now); if(ask==ptr+1){ s += left[0]; }else if(ask==ptr+2){ s += left[1]; }else{ s += left[2]; } ptr++; } ask1 = press(s+left[0]); ask2 = press(s+left[1]); if(ask1==N){ s+=left[0]; }else if(ask2==N){ s+=left[1]; }else{ s+=left[2]; } return s; } /* int main(){ //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout<<guess_sequence(3); return 0; } // */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...