QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#387776#4825. Even and Odd Combinationsberarchegas#0 0ms0kbC++20823b2024-04-12 20:01:052024-04-12 20:01:05

Judging History

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

  • [2024-04-12 20:01:05]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-04-12 20:01:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename T>
using matrix = vector<vector<T>>;
const int MAXN = 50;

int main(){
    cin.tie(0)->sync_with_stdio(0);

    

    int t;
    cin >> t;

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

        vector<int> v(k);
        for(int& i : v)
            cin >> i;
    
        set<int> s;

        for(int i = 1; i <= n; i++)
            s.insert(i);

        for(int i = 0; i < v.size(); i++){
            s.erase(v[i]);
        }
        if(n%2 == 1){
            if(s.count(1))
                s.erase(1);
            else s.insert(1);
        }
        

        cout << n << ' ' << s.size() << '\n';

        for(int i : s)
            cout << i << ' ';
        cout << '\n';
    }
}

详细

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 2
2 3 
2 1
2 
3 1
1 
3 3
1 2 3 
3 1
3 
3 1
2 

input:


output:


result:

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