QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#369834#5095. 九王唱zyc0704190 1ms3872kbC++201004b2024-03-28 18:28:002024-03-28 18:28:02

Judging History

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

  • [2024-03-28 18:28:02]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3872kb
  • [2024-03-28 18:28:00]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 5005;

inline int read() {
	char ch = getchar(); int x = 0;
	while (!isdigit(ch)) {ch = getchar();};
	while (isdigit(ch)) {x = x * 10 + ch - 48; ch = getchar();}
	return x;
}

int a[N][N];

void gen(int n, int seed) {
	mt19937 rnd(seed);
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n + 1; ++j) {
			a[i][j] = j;
			swap(a[i][j], a[i][rnd() % j + 1]);
		}
}

int n, seed;
bool vis[N];

int main() {
	n = read(); seed = read();
	if (seed) gen(n, seed);
	else {
		for (int i = 1; i <= n; ++i)
			for (int j = 1; j <= n + 1; ++j)
				a[i][j] = read();
	}
	for (int p = 1; p <= n; ++p) {
		for (int i = 1; i <= n + 1; ++i) vis[i] = false;
		for (int i = 1, x = p - 1; i <= n; ++i, --x) {
			if (x < 1) x += n;
			for (int j = 1; j <= n + 1; ++j)
				if (!vis[a[x][j]]) {vis[a[x][j]] = true; break;}
		}
		for (int i = 1; i <= n + 1; ++i)
			if (!vis[i]) {printf("%d ", i); break;}
	}
	return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 8
Accepted
time: 1ms
memory: 3872kb

input:

8 0
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5

output:

5 5 5 5 5 5 5 5 

result:

ok 8 numbers

Test #2:

score: -8
Wrong Answer
time: 0ms
memory: 3828kb

input:

8 0
4 7 8 6 1 3 2 9 5
5 8 9 7 2 4 3 1 6
6 9 1 8 3 5 4 2 7
7 1 2 9 4 6 5 3 8
8 2 3 1 5 7 6 4 9
9 3 4 2 6 8 7 5 1
1 4 5 3 7 9 8 6 2
2 5 6 4 8 1 9 7 3

output:

3 3 3 3 3 3 3 3 

result:

wrong answer 1st numbers differ - expected: '7', found: '3'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%