QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294285#4825. Even and Odd Combinationsucup-team027#0 0ms0kbC++14903b2023-12-30 11:18:232023-12-30 11:18:23

Judging History

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

  • [2023-12-30 11:18:23]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-12-30 11:18:23]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long

using namespace std;

signed main(){
    ios::sync_with_stdio(0); cin.tie(0);
//    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    int t;

    cin >> t;

    while (t--) {
        int n, k;

        cin >> n >> k;

        vector<int> a(k);

        for (int &u: a) {
            cin >> u;
        }

        set<int> s(a.begin(), a.end());

        set<int> b;

        for (int i = 1 ; i <= n ; i++) {
            if (s.find(i) == s.end()) {
                b.insert(i);
            }
        }

        if (n % 2 == 0) {
            if (s.find(n) != s.end()) {
                b.insert(n);
            }
        }

        cout << n << " " << b.size() << "\n";

        for (int u: b) {
            cout << u << " ";
        }

        cout << "\n";
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer on the first run

input:

6
3 0
2 1
1
3 3
1 2 3
3 1
1
3 1
2
3 1
3

output:

3 3
1 2 3 
2 1
2 
3 0

3 2
2 3 
3 2
1 3 
3 2
1 2 

input:


output:


result:

wrong answer the size of your subset must have a different parity (test case 2)