QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#111136#6569. Splitting PairsKhNURE_KIVI#WA 2ms3472kbC++201.7kb2023-06-05 22:18:192023-06-05 22:18:21

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-05 22:18:21]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3472kb
  • [2023-06-05 22:18:19]
  • 提交

answer

//#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4")
#include <bits/stdc++.h>

#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define fi first
#define se second

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

template<typename T>
inline bool umin(T &a, T b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
inline bool umax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#ifdef LOCAL
#define D for (bool _FLAG = true; _FLAG; _FLAG = false)
#define LOG(...) print(#__VA_ARGS__" ::", __VA_ARGS__) << endl
template <class ...Ts> auto &print(Ts ...ts) { return ((cerr << ts << " "), ...); }
#else
#define D while (false)
#define LOG(...)
#endif // LOCAL

const int max_n = -1, inf = 1000111222;

inline void test_case () {
    int n;
    cin >> n;
    vector <ll> a(n);
    int cnt[2] = {};
    for (auto &i : a) {
        cin >> i;
        ++cnt[i & 1ll];
    }
    if (cnt[1] == n) {
        cout << "0\n";
        return;
    }
    if (n % 2 == 0) {
        cout << "1\n";
        return;
    }
    if (cnt[0] && cnt[1]) {
        cout << "1\n";
        return;
    }
    cout << "0\n";
}

int main() {
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t;
    for (int test = 1; test <= t; test++) {
        test_case();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3472kb

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: 2ms
memory: 3424kb

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: 2ms
memory: 3432kb

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

result:

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