QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#511470 | #4825. Even and Odd Combinations | Elias | 0 | 0ms | 3748kb | C++20 | 676b | 2024-08-09 22:25:47 | 2024-08-09 22:25:52 |
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
cin.tie(0);
ios_base::sync_with_stdio(false);
int t;
cin >> t;
while (t--) {
int n, k;
cin >> n >> k;
int number = 0;
for (int i = 0; i < k; i++) {
int x;
cin >> x;
number |= (1ll << (x-1));
}
if (n % 2) {
number ^= (1ll << (n)) - 1;
} else {
number ^= (1ll << (n-1)) - 1;
}
vector<int> output;
for (int i = 0; i < n; i++) {
if (number & (1ll << i)) {
output.push_back(i + 1);
}
}
cout << n << " " << output.size() << "\n";
for (int x : output) {
cout << x << " ";
}
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3748kb
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'