QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#180872#6569. Splitting Pairsneko_nyaaWA 1ms3624kbC++20851b2023-09-16 13:54:282023-09-16 13:54:28

Judging History

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

  • [2023-09-16 13:54:28]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3624kb
  • [2023-09-16 13:54:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main() {
	ios::sync_with_stdio(0); cin.tie(0);

	int t; cin >> t;
	while (t--) {
		int n; cin >> n;
		vector<int> a(n);
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}

		if (n % 2) {
			int mk = 0;
			for (int i = 0; i < n; i++) {
				mk = max(mk, (int)__builtin_ctzll(a[i]));
			}
			for (int i = 0; i < n; i++) {
				a[i] /= (1LL << mk);
			}

			int o = 0, e = 0;
			for (int i = 0; i < n; i++) {
				if (a[i] % 2) o = 1;
				else e = 1;
			}

			// lose if all odd
			if (e) cout << "1\n";
			else cout << "0\n";
		} else {
			int o = 0, e = 0;
			for (int i = 0; i < n; i++) {
				if (a[i] % 2) o = 1;
				else e = 1;
			}

			// lose if all odd
			if (e) cout << "1\n";
			else cout << "0\n";
		}
	}

	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3616kb

input:

4
3
1 1 1
3
1 1 2
3
2 2 2
4
4 4 4 4

output:

0
1
0
1

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

1000
10
16 16 16 16 16 16 16 16 16 16
10
16 16 16 16 16 16 16 16 17 16
10
16 16 16 16 16 16 16 18 16 16
10
16 16 16 19 16 16 16 16 16 16
10
16 16 16 16 20 16 16 16 16 16
10
17 16 16 16 17 16 16 16 16 16
10
16 16 16 16 16 16 16 16 18 17
10
16 16 19 16 16 16 16 17 16 16
10
17 16 16 16 16 16 16 20 16 1...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 1000 lines

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3624kb

input:

1000
2
4 4
2
5 4
2
4 6
2
7 4
2
4 8
2
5 5
2
6 5
2
7 5
2
8 5
2
6 6
2
7 6
2
8 6
2
7 7
2
7 8
2
8 8
3
4 4 4
3
4 5 4
3
4 4 6
3
4 7 4
3
8 4 4
3
4 5 5
3
6 4 5
3
4 5 7
3
8 5 4
3
6 4 6
3
7 4 6
3
8 4 6
3
4 7 7
3
7 8 4
3
8 8 4
3
5 5 5
3
5 6 5
3
5 5 7
3
5 8 5
3
6 5 6
3
6 7 5
3
6 5 8
3
7 7 5
3
8 5 7
3
5 8 8
3
6 6...

output:

1
1
1
1
1
0
1
0
1
1
1
1
0
1
1
0
0
0
0
1
0
0
0
1
0
0
1
0
1
1
0
1
0
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
0
0
0
1
0
0
0
1
0
0
1
0
1
1
0
0
0
1
0
0
1
0
1
1
0
0
1
0
1
...

result:

wrong answer 17th lines differ - expected: '1', found: '0'