제출 #1305869

#제출 시각아이디문제언어결과실행 시간메모리
1305869farica콤보 (IOI18_combo)C++20
5 / 100
1 ms400 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("A");
	if(tmp) ans = "A";
	else if(press("B")) ans = "B";
	else if(press("X")) ans = "X";
	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;
		}
	}
	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];
	}
	for(char ch: c) {
		if(press(ans+ch) == N) {
			ans += ch;
			break;
		}
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...