QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#300351 | #4825. Even and Odd Combinations | wxhtzdy | 0 | 0ms | 0kb | C++20 | 1.0kb | 2024-01-08 04:10:17 | 2024-01-08 04:10:18 |
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int tt;
cin >> tt;
while (tt--) {
int n, k;
cin >> n >> k;
vector<int> a(k);
for (int i = 0; i < k; i++) {
cin >> a[i];
--a[i];
}
vector<int> c(n);
for (int i = 0; i < k; i++) {
c[a[i]] = 1;
}
if (n % 2 == 1) {
vector<int> res;
for (int i = 0; i < n; i++) {
if (c[i] == 0) {
res.push_back(i);
}
}
cout << (int) res.size() << '\n';
for (int i : res) {
cout << i + 1 << " ";
}
cout << '\n';
} else {
vector<int> res;
for (int i = 0; i + 1 < n; i++) {
if (c[i] == 0) {
res.push_back(i);
}
}
if (c[n - 1]) {
res.push_back(n - 1);
}
cout << (int) res.size() << '\n';
for (int i : res) {
cout << i + 1 << " ";
}
cout << '\n';
}
}
return 0;
}
詳細信息
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 1 2 3 0 0 2 2 3 2 1 3 2 1 2
input:
output:
result:
wrong answer Integer parameter [name=n] equals to 3, violates the range [2, 2] (test case 2)