Submission #91440

#TimeUsernameProblemLanguageResultExecution timeMemory
91440SaboonCombo (IOI18_combo)C++14
0 / 100
2 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;
const int maxn = 2e5 + 10;

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
			swap(mp[0], mp[1]);
	}
	else{
		if (press("X") == 1)
			swap(mp[0], mp[2]);
		else
			swap(mp[0], mp[3]);
	}
	t += mp[0];
	for (int i = 2; i <= n - 1; i++){
		string 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...