제출 #300569

#제출 시각아이디문제언어결과실행 시간메모리
300569aymane7콤보 (IOI18_combo)C++17
5 / 100
1 ms200 KiB
#include<bits/stdc++.h> #include "combo.h" #pragma GCC optimize("O2") #define S second #define F first #define PB push_back #define sz(x) (int) x.size() #define all(x) x.begin(),x.end() #define L(x) 2*x #define R(x) 2*x+1 #define M(x,y) (x+y)/2 using namespace std; typedef long long ll; /* int press(string s){ cout<<s <<"?"<<endl; int ans; cin>>ans; return ans; } */ string guess_sequence(int n){ vector<string> pos; string ans; string f; if(press("A")){ ans="A"; pos.PB("B"); pos.PB("X"); pos.PB("Y"); } else if(press("B")){ ans="B"; pos.PB("A"); pos.PB("X"); pos.PB("Y"); } else if(press("X")){ ans="X"; pos.PB("A"); pos.PB("B"); pos.PB("Y"); } else{ ans="Y"; pos.PB("A"); pos.PB("B"); pos.PB("X"); } for(int i=2;i<=n-1;i++){ string query=ans+pos[0]+ans+pos[1]+pos[0] +ans+pos[1]+pos[1] +ans+pos[1]+pos[2]; int q=press(query); if(q==sz(ans)){ ans+=pos[2]; } else if(q==sz(ans)+1){ ans+=pos[0]; } else ans+=pos[1]; } if(press(ans+"A")==n){ ans+="A"; } else if(press(ans+"B")==n){ ans+="B"; } else if(press(ans+"X")==n){ ans+="X"; } else{ ans+="Y"; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...