QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#711391 | #6569. Splitting Pairs | Djangle162857 | WA | 0ms | 3596kb | C++14 | 1.5kb | 2024-11-05 10:24:21 | 2024-11-05 10:24:22 |
Judging History
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 cnt = 0;
for (int i = 1; i <= n; i++) {
if (a[i] % 2 == 0) {
cnt++;
}
}
cout << (cnt >= n / 2) << endl;
}
else {
int mn = inf, flag = 0;
for (int i = 1; i <= n; i++) {
mn = min(mn, lowbit(a[i]));
}
for (int i = 1; i <= n; i++) {
a[i] = a[i] / (1 << mn);
if (a[i] % 2 == 0)
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: 0
Wrong Answer
time: 0ms
memory: 3596kb
input:
4 3 1 1 1 3 1 1 2 3 2 2 2 4 4 4 4 4
output:
1 1 1 1
result:
wrong answer 1st lines differ - expected: '0', found: '1'