Submission #1229237

#TimeUsernameProblemLanguageResultExecution timeMemory
1229237fauntleroyCombo (IOI18_combo)C++20
0 / 100
0 ms412 KiB
#include <iostream>
#include <cstdio>
#include <vector>
#include <array>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <limits>
#include <tuple>
#include <stack>
#include <bitset>
#include <cstring>
#include <sstream>
#include <functional>
#include <random>
#include "combo.h"
using namespace std;

string guess_sequence(int N) {
	string ans;
	for (char c : {'A', 'B', 'X', 'Y'}) 
		if (press(string(1, c))) {
			ans.push_back(c);
			break;
		}
	char p[3];
	int k = 0;
	for (char c : {'A', 'B', 'X', 'Y'})
		if (c != ans[0])
			p[k++] = c;

	for (int i = 1; i < N; i++) {
		string ask;
		ask += ans; ask += p[0];
		ask += ans; ask += p[1]; ask += p[0];
		ask += ans; ask += p[1]; ask += p[1];
		ask += ans; ask += p[1]; ask += p[2];
		int q = press(ask);
		if (q == 3)
			ans.push_back(p[1]);
		else if (q == 2)
			ans.push_back(p[0]);
		else
			ans.push_back(p[2]);
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...