제출 #91445

#제출 시각아이디문제언어결과실행 시간메모리
91445Saboon콤보 (IOI18_combo)C++17
0 / 100
1 ms328 KiB
#include <bits/stdc++.h>
#include "combo.h"

#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

map <int, char> mp;

string guess_sequence(int n){
	mp[0] = 'A';
	mp[1] = 'B';
	mp[2] = 'X';
	mp[3] = 'Y';
	string t;
	if (press("AB") >= 1){
		if (press("A") == 1)
			throw;
		else{
			mp[0] = 'B';
			mp[1] = 'A';
		}
	}
	else{
		if (press("X") == 1){
			mp[0] = 'X';
			mp[2] = 'A';
		}
		else{
			mp[0] = 'Y';
			mp[3] = 'A';
		}
	}
	t += mp[0];
	string s;
	for (int i = 2; i <= n - 1; i++){
		s = t + mp[1] + mp[1] + t + mp[1] + mp[2] + t + mp[1] + mp[3] + t + mp[2];
		int x = press(s);
		if (x == i + 1)
			t += mp[1];
		else if (x == i)
			t += mp[2];
		else
			t += mp[3];
	}
	if (press(t + mp[1] + t + mp[2]) == n){
		if (press(t + mp[1]) == n)
			t += mp[1];
		else
			t += mp[2];
	}
	else
		t += mp[3];
	return t;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...