Codeforces Round 983 (Div. 2) - A

题目链接:https://codeforces.com/problemset/problem/2032/A

题解代码:

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

void solve() {
    int n;
    cin >> n;
    
    int count0 = 0, count1 = 0;
    for (int i = 0; i < n * 2; i++) {
        int x;
        cin >> x;
        if (x == 0) count0++;
        else count1++;
    }

    int mi = (count0 % 2 + count1 % 2) / 2;
    int ma = min(count0, count1);
    
    cout << mi << " " << ma << endl;
}

int main() {

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

    return 0;
}
posted @ 2024-11-11 14:27  chhh31  阅读(4)  评论(0编辑  收藏  举报