# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1043865 | Melanie_Menjivar | 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 "combo.h"
// abreviaciones de datos y funciones de ellas
#define ll long long
#define st string
#define p pair
#define f first
#define s second
#define v vector
#define pb push_back
#define vll vector <long long>
#define vst vector<string>
#define vpll vector <pair<ll,ll>>
#define vvll v<vll>
#define as assign
#define pll pair<ll,ll>
#define matrizll v<vll>
#define matrizch v<v<char>>
#define itrll vll::iterator
#define itrst vst::iterator
#define itrpll vpll::iterator
#define all(x) x.begin(),x.end()
#define pq priority_queue
#define pq_ll pq <ll>
#define pq_st pq <st>
#define pq_pll pq<pll>
// abreviaciones funciones de impresion
#define espa ' '
#define en '\n'
#define coutv(a) for(auto x:a){cout<<x<<en;}
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
//funciones comunes
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repm(i,a) for(ll i=a;i>=0;i--)
#define test(t) while(t--)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end());
using namespace std;
std::string guess_sequence(int N) {
st S,pasado;
int consu;
string letras[3];
rep(i,0,n){
if(i==0){
consu=press("AB");
if(consu==0){
if(press("X")==0){
S+="Y";
letras[0]="A";letras[1]="B";letras[2]="X";
}else{
S+="X";
letras[0]="A";letras[1]="B";letras[2]="Y";
}
}else if(consu==1){
if(press("A")==1){
S+="A";
letras[0]="B";letras[1]="X";letras[2]="Y";
}else {
S+="B";
letras[0]="A";letras[1]="X";letras[2]="Y";
}
}else{
S+="A"
letras[0]="B";letras[1]="X";letras[2]="Y";
}
}else if(i==n-1){
consu=press(letras[0]);
if(consu==0){
if(press(letras[1])==0){
S+=letras[2];
}else{
S+=letras[1];
}
}else{
S+=letras[0];
}
}else{
consu=press(S+letras[0]+S+letras[1]+letras[0]+S+letras[1]+letras[1]+S+letras[1]+letras[2])
if(consu==S.size()+1){
S+=letras[0];
}else if(consu==S.size()+2){
S+=letras[1];
}else{
S+=letras[2];
}
}
}
return S;
}