求助
查看原帖
求助
685398
ssine233楼主2024/7/19 11:28
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+10;
ll n, ans[N];
bool ask(ll x, ll y) {
	ll r;
	printf("2 %lld %lld", x, y);
	fflush(stdout);
	scanf("%lld", &r);
	return (r==x);
}
struct r {
	ll id;
	bool operator <(const r &s) const
	 {	return ask(s.id, id);	}
};
priority_queue<r> q;

int main() {
	scanf("%lld", &n);
	for(ll i=1; i<=n; i++) 	q.push({i});	
	for(ll i=1; i<=n; i++) {
		auto t = q.top();
		ans[i] = t.id;
		q.pop();			
	}
	printf("3 ");
	for(ll i=1; i<=n; i++) printf("%lld ", ans[i]);	
	fflush(stdout);	
	return 0;
}

自己造数据都过了,但是0分。

2024/7/19 11:28
加载中...