# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
414072 | arneves | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
const int MOD = 1'000'000'007;
const int MX = 400'005;
//long double PI = 3.14159265358979323846264338327950;
const string k="ABXY";
int pergunta(string s){
int ans=0;
int r=press(s+k[0]+s+k[1]);
if(r==s.length())ans+=2;
r=press(s+k[0]+s+k[2]);
if(r==s.length())ans+=1;
return ans;
}
string guess_sequence(int N) {
int id[4];
string ans;
for(int i=0; i<4; i++) id[i]=i;
int y=pergunta("");
ans+=k[y];
swap(id[y],id[3]);
for(int i=1; i<N-1; i++){
string perg;
perg+=ans+k[id[1]];
perg+=ans+k[id[2]]+k[id[0]];
perg+=ans+k[id[2]]+k[id[1]];
perg+=ans+k[id[2]]+k[id[2]];
y=press(perg);
if(y==ans.length()){
ans+=k[id[0]];
}else if(y==ans.length()+1){
ans+=k[id[1]];
}else{
ans+=k[id[2]];
}
}
y=pergunta(ans);
ans+=k[y];
return ans;
}