QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#711378#6569. Splitting PairsDjangle162857WA 2ms3600kbC++141.4kb2024-11-05 10:10:562024-11-05 10:10:57

Judging History

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

  • [2024-11-05 10:10:57]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3600kb
  • [2024-11-05 10:10:56]
  • 提交

answer

#define LOCAL
#include <bits/stdc++.h>
#define fir first
#define sec second
#define el '\n'

#ifdef LOCAL
#define FINISH cerr << "FINISH" << endl;
#else
#define FINISH ;
#endif

#ifdef LOCAL
#define debug(x) cerr << setw(4) << #x << " == " << x << endl
#else
#define debug(x)
#endif

#ifdef LOCAL
#define debugv(x)                   \
	cerr << setw(4) << #x << ":: "; \
	for (auto i : x)                \
		cerr << i << " ";           \
	cerr << endl
#else
#define debugv(x)
#endif

using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
ostream& operator<<(ostream& out, PII& x)
{
	out << x.fir << " " << x.sec << endl;
	return out;
}
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int N = 200020;
int lowbit(int x)
{
	return x & (-x);
}
void solve()
{
	int n;
	cin >> n;
	vector<int> a(n + 1, 0);
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	if (n % 2 == 0) {
		int flag = 1;
		for (int i = 1; i <= n; i++) {
			if (a[i] % 2 == 1)
				flag = 0;
		}
		cout << flag << endl;
	}
	else {
		int flag = 0;
		for (int i = 1; i <= n; i++) {
			if (lowbit(a[i]) != lowbit(a[1])) {
				flag = 1;
			}
		}
		cout << flag << endl;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: -100
Wrong Answer
time: 2ms
memory: 3600kb

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
0
1
0
1
0
0
0
0
1
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 2nd lines differ - expected: '1', found: '0'