QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#514110#8217. King's Dinnerwallace114514WA 0ms3780kbC++141.6kb2024-08-10 21:57:002024-08-10 21:57:02

Judging History

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

  • [2024-08-10 21:57:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3780kb
  • [2024-08-10 21:57:00]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N=105;
 
int t,n;
char a[N][N];
char m[N][N][N]={
	{{'.'}},{{'#','.'},{'#','.'}},{{'#','.','#'},{'#','.','#'},{'.','.','.'}},
	{{'#','.','#','#'},{'#','.','.','.'},{'.','.','.','#'},{'#','#','.','#'}},
	{{'#','#','.','#','#'},{'.','.','.','.','.'},{'#','#','.','#','#'},{'.','.','.','.','.'},{'#','#','.','#','#'}},
	{{'#','#','.','#','.','#'},{'.','.','.','#','.','#'},{'#','#','.','.','.','.'},{'.','.','.','.','#','#'},{'#','.','#','.','.','.'},{'#','.','#','.','#','#'}},
	{{'#','.','#','.','#','.','#'},
	{'#','.','#','.','#','.','#'},
	{'.','.','.','.','.','.','.'},
	{'#','.','#','.','#','.','#'},
	{'#','.','#','.','#','.','#'},
	{'.','.','.','.','.','.','.'},
	{'#','#','.','#','#','.','.'}
	}
};
void dfs(int x) {
	if(x>7) {
		if(x%2==0) {
			for(int i=1;i<=x-6;i+=2) a[x-4][i]=a[x-3][i]=a[x-1][i]=a[x][i]='#';
			for(int i=1;i<=x;i+=2) a[i+1][x-4]=a[i+1][x-3]=a[i+1][x-1]=a[i+1][x]='#';
		}else {
			for(int i=1;i<=x-9;i+=2) a[x-4][i]=a[x-3][i]=a[x-1][i]=a[x][i]='#';
			a[x][x-8]=a[x][x-7]=a[x-2][x-8]=a[x-2][x-7]=a[x-4][x-8]=a[x-4][x-7]='#';
			for(int i=1;i<=x-3;i+=2) a[i+1][x-4]=a[i+1][x-3]=a[i+1][x-1]=a[i+1][x]='#';
			a[x][x]=a[x-1][x]=a[x][x-2]=a[x-1][x-2]=a[x][x-4]=a[x-1][x-4]='#';
		}
		dfs(x-6);
		return;
	}
	for(int i=1;i<=x;i++) {
		for(int j=1;j<=x;j++) {
			a[i][j]=m[x-1][i-1][j-1];
		} 
	}
}

int main(){
	cin>>t;
	while(t--) {
		cin>>n;
		for(int i=1;i<=n;i++) {
			for(int j=1;j<=n;j++) {
				a[i][j]='.';
			}
		}
		dfs(n);
		for(int i=1;i<=n;i++) {
			for(int j=1;j<=n;j++) cout<<a[i][j];
			cout<<endl;
		}
	}
	return 0;
}

詳細信息

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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 = 13, pans = 11 (test case 8)