# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
236187 | davi_bart | 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.
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define o_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define int ll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string guess_sequence(int N){
vector<char> k={'A','B','X','Y'};
string sol="";
int a=press("AB");
if(a){
int b=press("A");
if(b){
sol="A";
k.erase(k.begin());
}else{
sol="B";
k.erase(k.begin()+1);
}
}else{
int b=press("C");
if(b){
sol="C";
k.erase(k.begin()+2);
}else{
sol="D";
k.erase(k.begin()+3);
}
}
for(int i=1;i<N;i++){
int z=press(sol+k[0]+k[0]+sol+k[0]+k[1]+sol+k[0]+k[2]+sol+k[1]);
if(z==i)sol+=k[2];
else if(z==(i+1))sol+=k[1];
else sol+=k[0];
}
return sol;
}
/*
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);
cout<<guess_sequence(5);
}*/