QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#511470#4825. Even and Odd CombinationsElias0 0ms3748kbC++20676b2024-08-09 22:25:472024-08-09 22:25:52

Judging History

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

  • [2024-08-09 22:25:52]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3748kb
  • [2024-08-09 22:25:47]
  • 提交

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'