제출 #678352

#제출 시각아이디문제언어결과실행 시간메모리
678352ensonlung콤보 (IOI18_combo)C++17
100 / 100
38 ms636 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

std::string guess_sequence(int N) {
	int n=N;
	int ans=press("AB");
	string c;
	string s="";
	if (ans>0){
		ans=press("A");
		if (ans>0) c="ABXY";
		else c="BAXY";
	}
	else{
		ans=press("X");
		if (ans==1) c="XABY";
		else c="YABX";
	}
	s+=c[0];
	for (int i=1;i<n-1;i++){
		ans=press(s+c[1]+c[1]+s+c[1]+c[2]+s+c[1]+c[3]+s+c[2]);
		if (ans==i) s+=c[3];
		else if (ans==i+1) s+=c[2];
		else s+=c[1];
	}
	if (n>1){
		ans=press(s+c[1]);
		if (ans==n) s+=c[1];
		else{
			ans=press(s+c[2]);
			if (ans==n) s+=c[2];
			else s+=c[3];
		}
	}
	return s;
	
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...