# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
156412 | InfiniteJest | 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 <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ifstream in("input.txt");
ofstream out("output.txt");
typedef long long ll;
int n;
string g;
string s;
vector<string> p;
int press(string p)
string guess_sequence(int N){
n=N;
if(press("AB")>=1){
if(press("A")>=1)s+="A";
else s+="B";
}
else{
if(press("X")>=1)s+="X";
else s+="Y";
}
if(s[0]!='A')p.pb("A");
if(s[0]!='B')p.pb("B");
if(s[0]!='X')p.pb("X");
if(s[0]!='Y')p.pb("Y");
for(int i=1;i<=n-2;i++){
int k=press(s+p[0]+s+p[1]+p[0]+s+p[1]+p[2]+s+p[1]+p[1]);
if(k==i+1){
s+=p[0];
}
else if(k>i+1){
s+=p[1];
}
else{
s+=p[2];
}
}
if(n==1)return s;
if(press(s+p[0]+s+p[1])==n){
if(press(s+p[0])==n)s+=p[0];
else s+=p[1];
}
else{
s+=p[2];
}
return s;
}