QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#152745#6569. Splitting PairsBUET_POISSON#WA 3ms3684kbC++201.5kb2023-08-28 19:10:352023-08-28 19:10:36

Judging History

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

  • [2023-08-28 19:10:36]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3684kb
  • [2023-08-28 19:10:35]
  • 提交

answer

#include <bits/stdc++.h>
 
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 
#define togglebit(n, i) ((n) ^ (1LL << (i))) 
#define lastone(n) ((n) & (-(n))) 
char gap = 32;
#define int long long
#define ll long long 
#define lll __int128_t
#define pb push_back

int recurse(int n, int d) {
    if(n == 1) return 0;
    if(d == 0) return 1e18;
    int ans = 0;
    __int128_t N = n;
    __int128_t D = d;
    for(int i = 1; i <= 62; i++) {
        __int128_t temp = ((1LL << i) - 1);
        temp = temp * D + 1;
        if(temp >= N) {
            ans = i;
            break;
        }
    }
    int left = n / 2;
    int right = n - left;
    ans = min({ans, recurse(right, d - 1) + 1});
    return ans;
}
void solve() {
    int n;
    cin >> n;
    int o = 0, e = 0;
    for (int i=0; i<n; i++) {
        int x;
        cin >> x;
        if (x & 1) o++;
        else e++;
    }

    if (n % 2 == 0) {
        if (e) {
            cout << 1 << endl;
        }
        else {
            cout << 0 << endl;
        }
    } else {
        if (e == n) {
            cout << 0 << endl;
        }
        else if (e) {
            cout << 1 << endl;
        }
        else {
            cout << 0 << endl;
        }
    }
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t; cin >> t;
    while(t--) {
        solve();
    }
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3584kb

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: 3ms
memory: 3556kb

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: 3684kb

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'