제출 #430003

#제출 시각아이디문제언어결과실행 시간메모리
430003Icebear16콤보 (IOI18_combo)C++14
30 / 100
80 ms552 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
string guess_sequence(int n){
	string p="";
	int h=0,k=press(p+'A');
	if((k-h)==1){h=h+1;p+='A';}
	else{
		k=press(p+'B');
		if((k-h)==1){h=h+1;p+='B';}
		else{
			k=press(p+'X');
			if((k-h)==1){h=h+1;p+='X';}
			else{k+=1;h=h+1;p+='Y';}
		}
	}
	char c=p[0];
	vector<char> v={'A','B','X','Y'};vector<char> b;
	for(int i=0;i<4;i++){
		if(c!=v[i]){b.push_back(v[i]);}
	}
	while(k!=n){
		k=press(p+b[0]);
		if((k-h)==1){h=h+1;p+=b[0];}
		else{
			k=press(p+b[1]);
			if((k-h)==1){h=h+1;p+=b[1];}
			else{k+=1;h=h+1;p+=b[2];}
		}
		if(k==n)break;
	}
	return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...