QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#296645#4825. Even and Odd Combinationsdefyers#0 0ms3472kbC++17836b2024-01-03 12:22:482024-01-03 12:22:49

Judging History

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

  • [2024-01-03 12:22:49]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3472kb
  • [2024-01-03 12:22:48]
  • 提交

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'