Submission #301878

#TimeUsernameProblemLanguageResultExecution timeMemory
301878DovranCombo (IOI18_combo)C++11
5 / 100
1 ms200 KiB
#include <bits/stdc++.h> #include "combo.h" #define N 100009 #define pii pair <int, int> #define ff first #define sz() size() #define ss second #define pb push_back #define ll long long using namespace std; char c[5]={'X', 'Y', 'A', 'B'}; string a; /* int press(string ss){ cout<<ss<<'\n'; int y; cin>>y; return y; } */ string guess_sequence(int n){ string s; int in; s+="AB"; int x=press(s); if(x){ s='A'; in=3; x=press(s); if(x) in=2; } else{ s='X'; in=1; x=press(s); if(x) in=0; } s=c[in]; swap(c[in], c[3]); for(int i=2; i<n; i++){ a=s+c[0]; a+=s+c[1]+c[0]; a+=s+c[1]+c[1]; a+=s+c[1]+c[2]; x=press(a); if(x==i){ s+=c[0]; if(x==n) return s; } else if(x==i+1) s+=c[1]; else{ s+=c[2]; if(x==n) return s; } } a=s+c[0]; x=press(a); if(x==n) return a; a=s+c[1]; x=press(a); if(x==n) return a; s+=c[2]; return s; } /* int main(){ int n; cin>>n; cout<<guess_sequence(n); }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...