本题建议降难度
查看原帖
本题建议降难度
957484
lanxian楼主2023/11/21 00:22

建议降到普及-

#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
typedef pair<int, int> PII;
priority_queue<PII, vector<PII>,  less<PII>> heap;
int arr[1000050];
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int a, b,n;
	memset(arr, 0, sizeof(arr));
	cin >> n;
	for (int i = 1;i <= n;i++) {
		cin >> a >> b;
		if (a == (a ^ b)) {
			arr[a]++;
		}
		else {
			arr[a]++;
			arr[a ^ b]++;
		}
	}
	for (int i = 0;i <= 1000010;i++) {
		heap.push({ arr[i],-i });
	}
	cout << -heap.top().second;
	return 0;
}
2023/11/21 00:22
加载中...