제출 #370857

#제출 시각아이디문제언어결과실행 시간메모리
370857rc_catunta콤보 (IOI18_combo)C++14
30 / 100
70 ms572 KiB
#include "combo.h"
using namespace std;

string guess_sequence(int N) {
  	string p = "";
  	string S = "";
  	string patron = "ABXY";
  	if(press("A")) S="A";
  	else if(press("B")) S="B";
  	else if(press("X")) S="X";
  	else S="Y";
  	char primera_letra=S[0];
  	for(int i=2;i<=N;i++){
  		//Recorremos el patron
  		int fallos=0;
  		for(int j=0;j<4;j++){
  			if(patron[j]!=primera_letra){
  				if(fallos==2){
  					S=S+patron[j];
  				}
  				else{
  					if(press(S+patron[j])==i){
  						S=S+patron[j];
  						break;
  					}
  					else{
  						fallos++;
  					}	
  				}
  				
  			}
  		}
  	}
	return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...