QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#443896#8217. King's Dinner_l_l_WA 0ms3856kbC++141.9kb2024-06-15 16:46:162024-06-15 16:46:17

Judging History

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

  • [2024-06-15 16:46:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3856kb
  • [2024-06-15 16:46:16]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
char str[MAXN][MAXN];
void draw(int dx, int dy, int n) {
	if (n < 2) return;
	if (n == 2) return str[dx][dy] = str[dx][dy + 1] = '#', void();
	if (n == 3) return str[dx][dy] = str[dx][dy + 1] = str[dx + 2][dy] = str[dx + 2][dy + 1] = '#', void();
	if (n % 2 == 0) {
		for (int i = 1; i < n / 2; i++) {
			str[dx][dy + 2 * i - 2] = str[dx + 1][dy + 2 * i - 2] = '#';
			str[dx + 2 * i + 1][dy] = str[dx + 2 * i + 1][dy + 1] = '#';
			str[dx + n - 1][dy + 2 * i + 1] = str[dx + n - 2][dy + 2 * i + 1] = '#';
			str[dx + 2 * i - 2][dy + n - 1] = str[dx + 2 * i - 2][dy + n - 2] = '#';
		}
		draw(dx + 3, dy + 3, n - 6);
	}
	else if (n % 3 == 1) {
		for (int i = 1; i <= n / 3; i++) {
			str[dx][dy + 3 * i - 3] = str[dx][dy + 3 * i - 2] = '#';
			str[dx + 3 * i - 1][dy] = str[dx + 3 * i][dy] = '#';
			str[dx + 3 * i - 3][dy + n - 1] = str[dx + 3 * i - 2][dy + n - 1] = '#';
			str[dx + n - 1][dy + 3 * i - 1] = str[dx + n - 1][dy + 3 * i] = '#';
		}
		draw(dx + 2, dy + 2, n - 4);
	}
	else if (n % 3 == 2) {
		for (int i = 1; i <= n / 2 + 1; i++) for (int j = 1; j <= n / 3 + 1; j++) {
			str[dx + i * 2 - 2][dy + j * 3 - 3] = str[dx + i * 2 - 2][dy + j * 3 - 2] = '#';
		}
	}
	else {
		// for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) str[dx + i - 1][dy + j - 1] = '?';
		draw(dx, dy, n / 2);
		draw(dx + n / 2 + 1, dy, n / 2);
		draw(dx, dy + n / 2 + 1, n / 2);
		draw(dx + n / 2 + 1, dy + n / 2 + 1, n / 2);
	}
}
int main() {
	int t; scanf("%d", &t); while (t--) {
		int n; scanf("%d", &n);
		for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) str[i][j] = '.';
		for (int i = 1; i <= n; i++) str[i][n + 1] = 0;
		draw(1, 1, n);
		for (int i = 1; i <= n; i++) puts(str[i] + 1);
	}
}
/*
#.##.##.#
#.......#
...#.#...
##.#.#.##
.........
##.#.#.##
...#.#...
#.......#
#.##.##.#
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

.
##
..
##.
...
##.

result:

ok all tests correct (3 test cases)

Test #2:

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

input:

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

output:

.
##
..
##.
...
##.
#.##
#...
...#
##.#
##.##
.....
##.##
.....
##.##
#.#.##
#.#...
....##
##....
...#.#
##.#.#
##.##.#
......#
#.##...
#.....#
..##..#
#......
#.##.##
#.#.#.##
#.#.#...
......##
##.##...
......##
##......
...#.#.#
##.#.#.#
#.##.#.##
#....#...
...#....#
##.#.##.#
.........
#.##.#.##
...

result:

wrong answer jury has the better answer: jans = 42, pans = 40 (test case 15)