URW玄关求调
查看原帖
URW玄关求调
1036180
ChampionCyan楼主2024/8/14 12:23

URW=UKE+RE+WA.

见\color{red}红$$+$$\color{blue}蓝$$=$$\color{purple}紫的提交记录

code:

#include <bits/stdc++.h>
using namespace std;
int n, best;
int a[20001];

bool cmp(int a, int b) {
	cout << 1 << " " << best << " " << a << " " << b << endl;
	int ans;
	cin >> ans;
	return ans == b;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	vector<int> mabye_the_best;
	for (int i = 1; i <= n; i++)
		mabye_the_best.push_back(i);
	while (mabye_the_best.size() != 2) {
		#define len ((int)mabye_the_best.size() - 1)
		int a = mabye_the_best[len], b = mabye_the_best[len - 1], c = mabye_the_best[len - 2];
		#undef len
		mabye_the_best.pop_back(), mabye_the_best.pop_back(), mabye_the_best.pop_back();
		cout << 1 << " " << a << " " << b << " " << c << endl;
		int ans;
		cin >> ans;
		if (ans == a)
			mabye_the_best.push_back(b), mabye_the_best.push_back(c);
		if (ans == b)
			mabye_the_best.push_back(a), mabye_the_best.push_back(c);
		if (ans == c)
			mabye_the_best.push_back(a), mabye_the_best.push_back(b);
	}
	cout << 2 << " " << mabye_the_best[0] << " " << mabye_the_best[1] << endl;
	cin >> best;
	for (int i = 1, now = 1; i < n; i++, now++) {
		if (best == i) 
			now--;
		else
			a[i] = now;
	}
	sort(a + 1, a + n, cmp);
	cout << "3 " << best << " ";
	for (int i = 1; i < n; i++)
		cout << a[i] << " ";
	fflush(stdout);
	return 0;
}
2024/8/14 12:23
加载中...