제출 #1229234

#제출 시각아이디문제언어결과실행 시간메모리
1229234fauntleroy콤보 (IOI18_combo)C++20
0 / 100
0 ms408 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(N, '?');
	for (char c : {'A', 'B', 'X', 'Y'}) 
		if (press(string(1, c))) {
			ans[0] = 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[i] = p[1];
		else if (q == 2)
			ans[i] = p[0];
		else
			ans[i] = p[2];
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...