# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
438032 | Bom164 | Combo (IOI18_combo) | C++14 | 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>
#include<iostream>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define pqb priority_queue<int>
#define pqs priority_queue<int,vi,greater<int> >
#define mod 1000000007
#define inf 1e18
#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--)
#define w(x) int x; cin>>x; while(x--)
string s="";
int press(string p){
int a;cin>>a;
return a;
}
string guess_sequence(int n){
if(press("A")==1) s+="A";
else if(press("B")==1) s+="B";
else if(press("X")==1) s+="X";
else s+="Y";
if(s=="A"){
while(s.size()!=n){
int c = press(s+"B"+s+"XB"+s+"XX"+s+"XY");
if(c==s.size()) s+="Y";
else if(c==s.size()+1) s+="B";
else s+="X";
}
}else if(s=="B"){
while(s.size()!=n){
int c = press(s+"A"+s+"XA"+s+"XX"+s+"XY");
if(c==s.size()) s+="Y";
else if(c==s.size()+1) s+="A";
else s+="X";
}
}else if(s=="X"){
while(s.size()!=n){
int c = press(s+"B"+s+"AB"+s+"AA"+s+"AY");
if(c==s.size()) s+="Y";
else if(c==s.size()+1) s+="B";
else s+="A";
}
}else if(s=="Y"){
while(s.size()!=n){
int c = press(s+"B"+s+"XB"+s+"XX"+s+"XA");
if(c==s.size()) s+="A";
else if(c==s.size()+1) s+="B";
else s+="X";
}
}
return s;
}