QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#283461#5687. 速战速决YeahPotato#WA 33ms11012kbC++14769b2023-12-14 17:33:082023-12-14 17:33:08

Judging History

This is the latest submission verdict.

  • [2023-12-14 17:33:08]
  • Judged
  • Verdict: WA
  • Time: 33ms
  • Memory: 11012kb
  • [2023-12-14 17:33:08]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 6e5 + 5;
int n, a[N], f = 1, c[N], x, t, q[N], ban[N];
int main() {
	cin >> n;
	for (int i=1; i<=n; i++)
		scanf ("%d", &a[i]), f &= ++ c[a[i]] & 1;
	if (f)
		if (n == 1) puts ("-1");
		else {
			printf ("%d\n%d", n + 2, a[n]);
			for (int i=1; i<n; i++) printf (" %d", a[i]);
			printf (" %d %d", a[1], a[1]);
		}
	else { printf ("%d\n", n);
		for (int i=1; i<=n; i++)
			if (! c[i] && ! x) x = i;
			else for (int j=c[i]; j<2; j++)
				q[++t] = j;
		for (int i=1, j=1; i<=n; i++) {
			if (! f) printf ("%d ", x), f = 1;
			else if (c[a[i]] == 2) {
				while (ban[q[j]]) j ++;
				printf ("%d ", q[j++]);
			} else printf ("%d ", x), f = 0, ban[a[i]] = 1;
			c[a[i]] --;
		}
	}
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 33ms
memory: 11012kb

input:

249665
195633 37425 205189 128330 159707 98406 111454 30346 158516 121742 107964 50039 201395 16843 182333 60177 195166 188257 172666 71779 157060 237654 123572 145065 57507 152240 187931 5706 191077 214174 70950 71272 172767 61529 85258 74139 44633 181186 223348 222711 19237 239887 20487 84130 1392...

output:

249665
2 2 2 2 2 2 2 2 2 1 2 2 1 2 2 0 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 0 1 2 2 2 2 2 2 2 2 0 2 2 2 2 1 2 2 1 2 2 0 1 2 2 1 2 2 2 2 1 2 2 1 1 1 2 2 1 0 1 2 2 2 2 2 2 2 2 0 1 1 1 2 2 1 0 1 2 2 2 2 1 2 2 2 2 1 2 2 0 2 2 1 2 2 0 1 2 2 2 2 1 2 2 1 1 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 1 0 1 1...

result:

wrong answer Integer parameter [name=card] equals to 0, violates the range [1, 249665]