제출 #588760

#제출 시각아이디문제언어결과실행 시간메모리
588760shezittCombo (IOI18_combo)C++14
97 / 100
34 ms560 KiB
#include "combo.h"
#include <bits/stdc++.h>
#define dbg(x) cerr << #x << ": " << x << endl;
#define raya cerr << "======================" << endl;
 
using namespace std;
 
string guess_sequence(int N) {
	string s = "";
	string aux = "ABXY";
	for(int j=0; j<4; ++j){
		s += aux[j];
		if(j == 3){
			break;
		}
		if(press(s)){
			break;
		}
		s.pop_back();
	}
	string tmp = aux;
	aux = "";
	for(char c : tmp){
		if(c != s[0]){
			aux += c;
		}
	}
	string a; a += aux[0];
	string b; b += aux[1];
	string c; c += aux[2];
	for(int i=1; i<N; ++i){
		if(i == N-1){
			int p = press(s+a);
			if(p == i+1){
				s += a;
				break;
			}
			p = press(s+b);
			if(p == i+1){
				s += b;
				break;
			}
			s += c;
			break;
		}
		int p = press(s+a+s+b+a+s+b+b+s+b+c);
		if(p == i+1){
			s += a;
		} else if(p == i+2){
			s += b;
		} else {
			s += c;
		}
	}
	return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...