QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#463426#4633. Coprime MatricesieeWA 3ms3840kbC++14903b2024-07-04 20:25:372024-07-04 20:25:37

Judging History

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

  • [2024-07-04 20:25:37]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3840kb
  • [2024-07-04 20:25:37]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int main() {
	cin.tie(0)->sync_with_stdio(0);
	int n, m, x, y, w;
	cin >> n >> m >> x >> y >> w;
	x--, y--, w--;
	vector<vector<int>> a(n, vector<int>(m));
	int tot = 0;
	for (int j = 0; j + 1 < m; j += 2) {
		for (int i = 0; i + 1 < n; i += 2) {
			a[i][j] = tot++;
			a[i][j + 1] = tot++;
			a[i + 1][j + 1] = tot++;
			a[i + 1][j] = tot++;
		}
	}
	if (n & 1) {
		for (int j = 0; j + 1 < m; j += 2) {
			a[n - 1][j] = tot++;
			a[n - 1][j + 1] = tot++;
		}
	}
	if (m & 1) {
		for (int i = 0; i + 1 < n; i += 2) {
			a[i][m - 1] = tot++;
			a[i + 1][m - 1] = tot++;
		}
	}
	if ((n & 1) && (m & 1)) {
		a[n - 1][m - 1] = tot++;
	}
	cout << "Yes" << "\n";
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cout << (a[i][j] + (w - a[x][y] + n * m)) % (n * m) + 1 << " \n"[j + 1 == m];
		}
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3836kb

input:

3 3 2 1 3

output:

Yes
9 1 6
3 2 7
4 5 8

result:

ok OK, Accepted.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

1 1 1 1 1

output:

Yes
1

result:

ok OK, Accepted.

Test #3:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

8 3 4 2 9

output:

Yes
3 4 19
6 5 20
7 8 21
10 9 22
11 12 23
14 13 24
15 16 1
18 17 2

result:

ok OK, Accepted.

Test #4:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

7 6 7 2 28

output:

Yes
33 34 3 4 15 16
36 35 6 5 18 17
37 38 7 8 19 20
40 39 10 9 22 21
41 42 11 12 23 24
2 1 14 13 26 25
27 28 29 30 31 32

result:

ok OK, Accepted.

Test #5:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

6 8 1 2 7

output:

Yes
6 7 18 19 30 31 42 43
9 8 21 20 33 32 45 44
10 11 22 23 34 35 46 47
13 12 25 24 37 36 1 48
14 15 26 27 38 39 2 3
17 16 29 28 41 40 5 4

result:

ok OK, Accepted.

Test #6:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

8 8 7 3 56

output:

Yes
28 29 44 45 60 61 12 13
31 30 47 46 63 62 15 14
32 33 48 49 64 1 16 17
35 34 51 50 3 2 19 18
36 37 52 53 4 5 20 21
39 38 55 54 7 6 23 22
40 41 56 57 8 9 24 25
43 42 59 58 11 10 27 26

result:

ok OK, Accepted.

Test #7:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

2 4 2 1 8

output:

Yes
5 6 1 2
8 7 4 3

result:

ok OK, Accepted.

Test #8:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

6 6 4 2 17

output:

Yes
11 12 23 24 35 36
14 13 26 25 2 1
15 16 27 28 3 4
18 17 30 29 6 5
19 20 31 32 7 8
22 21 34 33 10 9

result:

ok OK, Accepted.

Test #9:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

8 6 3 1 33

output:

Yes
29 30 45 46 13 14
32 31 48 47 16 15
33 34 1 2 17 18
36 35 4 3 20 19
37 38 5 6 21 22
40 39 8 7 24 23
41 42 9 10 25 26
44 43 12 11 28 27

result:

ok OK, Accepted.

Test #10:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

2 8 2 4 15

output:

Yes
9 10 13 14 1 2 5 6
12 11 16 15 4 3 8 7

result:

ok OK, Accepted.

Test #11:

score: -100
Wrong Answer
time: 3ms
memory: 3776kb

input:

295 280 79 198 74034

output:

Yes
16253 16254 16841 16842 17429 17430 18017 18018 18605 18606 19193 19194 19781 19782 20369 20370 20957 20958 21545 21546 22133 22134 22721 22722 23309 23310 23897 23898 24485 24486 25073 25074 25661 25662 26249 26250 26837 26838 27425 27426 28013 28014 28601 28602 29189 29190 29777 29778 30365 30...

result:

wrong answer Co-prime Unsatisfied