제출 #1235507

#제출 시각아이디문제언어결과실행 시간메모리
1235507akqxolotl콤보 (IOI18_combo)C++20
100 / 100
7 ms484 KiB
#include "combo.h"

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
#define pb push_back
typedef pair<int,int> pii;
#define fi first
#define se second
#define debug(x) cerr<<#x<<" is "<<x<<endl;

string bsta(string o){
	int x=o.length();
	int q=press(o+"A"+o+"B");
	if(q>x){
		q=press(o+"A");
		if(q>x)return "A";
		else return "B";
	}else{
		q=press(o+"X");
		if(q>x)return "X";
		else return "Y";
	}
}

std::string guess_sequence(int N) {
	string s="";
	s=bsta(s);
	if(N==1)return s;
	vector<string> g,a;
	if(s=="A")g={"BB","BX","BY","X"},a={"Y","X","B"};
	else if(s=="B")g={"AA","AX","AY","X"},a={"Y","X","A"};
	else if(s=="X")g={"AA","AB","AY","B"},a={"Y","B","A"};
	else if(s=="Y")g={"AA","AB","AX","B"},a={"X","B","A"};
	for(int i=1;i<N-1;i++){
		int q=press(s+g[0]+s+g[1]+s+g[2]+s+g[3]);
		q-=i;
		s+=a[q];
	}
	s+=bsta(s);
	return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...