QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#137194#5521. Excellent XOR ProblemThe_Hallak#WA 1ms3472kbC++171.0kb2023-08-10 03:46:492023-08-10 03:46:50

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-10 03:46:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3472kb
  • [2023-08-10 03:46:49]
  • 提交

answer

#include <bits/stdc++.h>

#define ll long long

using namespace std;

const ll N = 1e6 + 10, MM = 1e9 + 7, MAX = 1e18;

int solve() {
	int n; cin >> n;
	vector<ll>v(n+1);
	map<ll, ll>mp;
	for (int i = 0; i < n; i++) {
		cin >> v[i + 1];
		mp[v[i + 1]]++;
		v[i + 1] ^= v[i];
	}
	if (mp.size() == 1 && (n % 2 == 0||mp.begin()->first==0))return cout << "NO\n", 0;

	if (v[n] != 0) {
		cout << "YES\n2\n1 1\n2 " << n << '\n';
		return 0;
	}

	for (int i = 1; i <= n; i++) {
		if(v[i])
			mp[v[i]] = i;
	}
	if (mp.size() > 1) {
		cout << "YES\n";
		cout << 3 << '\n';
		int i = mp.begin()->second;
		int j = mp.begin()->second;
		if (i > j)swap(i, j);
		cout << 1 << " " << i << '\n';
		cout << i + 1 << " " << j << '\n';
		cout << j + 1 << n << '\n';

	}
	else {
		cout << "NO\n";
	}


	return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	cin >> t;
	int i = 1;
	while (t--) {
		//cout << "case " << i << ": ";
		solve();
	}
	return 0;
}
/*

*/

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3472kb

input:

4
2
0 0
3
1 2 3
5
16 8 4 2 1
6
42 42 42 42 42 42

output:

NO
YES
3
1 1
2 1
23
YES
2
1 1
2 5
NO

result:

wrong answer Integer 1 violates the range [2, 3] (test case 2)