제출 #1306013

#제출 시각아이디문제언어결과실행 시간메모리
1306013farica콤보 (IOI18_combo)C++20
0 / 100
1 ms332 KiB
#include "combo.h"
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;
using vi = vector<int>;
using pi = pair<int,int>;

string guess_sequence(int N) {
	string ans = "Y";
	int tmp = press("AB");
	if(tmp) {
		if(press("A")) ans = "A";
		else ans = "B";
	} else {
		if(press("X")) ans = "X";
		else ans = "Y";
	}
	vector<char>c({'A', 'B', 'X', 'Y'});
	for(int i=0; i<4; ++i) {
		if(c[i] == ans[0]) {
			c.erase(c.begin()+i);
			break;
		}
	}
	if(N == 1) return ans;
	for(int i=1; i<N-1; ++i) {
		string nw = ans + c[0] + c[0] + ans + c[0] + c[1] + ans + c[0] + c[2] + ans + c[1];
		tmp = press(nw);
		int len = (int)ans.length();
		if(tmp == len+1) ans += c[1];
		else if(tmp == len+2) ans += c[0];
		else ans += c[2];
	}
	tmp = press(ans + c[0] + ans + c[1]);
	if(tmp) {
		if(press(ans + c[0])) ans += c[0];
		else ans += c[1];
	} else ans += c[2];
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...