QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#296645 | #4825. Even and Odd Combinations | defyers# | 0 | 0ms | 3472kb | C++17 | 836b | 2024-01-03 12:22:48 | 2024-01-03 12:22:49 |
answer
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int n, k;
int a[55];
int num[55];
void encode() {
cin >> n >> k;
for (int i = 1; i <= n; i++) {
num[i] = 0;
}
for (int i = 1; i <= k; i++) {
cin >> a[i];
num[a[i]] = 1;
}
vector<int> ans;
if (n % 2) {
for (int i = 1; i <= n; i++) {
if (!num[i]) ans.push_back(i);
}
}
else {
for (int i = 1; i < n; i++) {
if (!num[i]) ans.push_back(i);
}
if (num[n]) ans.push_back(n);
}
cout << n << " " << (int)ans.size() << "\n";
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] << " \n"[i == ans.size() - 1];
}
}
void decode() {
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(10);
int t; cin >> t;
while (t--) encode();
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3472kb
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 0 3 0 3 2 2 3 3 2 1 3 3 2 1 2
input:
6 3 3 1 2 3 2 0 3 0 3 2 2 3 3 2 1 3 3 2 1 2
output:
3 0 2 1 1 3 3 1 2 3 3 1 1 3 1 2 3 1 3
result:
wrong answer 2nd lines differ - expected: '', found: '2 1'