QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#443508#8217. King's DinnerIratisAC ✓2ms4032kbC++141.4kb2024-06-15 15:44:572024-06-15 15:45:00

Judging History

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

  • [2024-06-15 15:45:00]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:4032kb
  • [2024-06-15 15:44:57]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define md(a) a=(a%mod+mod)%mod
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)

bool ST;

const int N=105;
int n,a[N][N],Bas;

inline void c(int x,int y){a[x+Bas-1][y+Bas-1]=1;}
void calc(int n,int p)
{
	if(!n)return ;Bas=p;
	if(n%6==0)
	{
		for(int i=1;i<=n/2-1;i++)
		{
			c(1,i*2-1),c(2,i*2-1),c(n,(i+1)*2),c(n-1,(i+1)*2);
			c(i*2-1,n),c(i*2-1,n-1),c((i+1)*2,1),c((i+1)*2,2);
		}
		calc(n-6,p+3);
	}
	if(n%6==2)
	{
		for(int i=1;i<=n;i+=2)c(1,i),c(2,i);
		for(int i=4;i<=n;i+=2)for(int j=1;j<=(n+1)/3;j++)c(i,j*3-2),c(i,j*3-1);
	}
	if(n%6==4||n%6==1)
	{
		for(int i=1;i<=n/3;i++)
		{
			c(1,i*3-2),c(1,i*3-1),c(n,i*3),c(n,i*3+1);
			c(i*3-2,n),c(i*3-1,n),c(i*3,1),c(i*3+1,1);
		}
		calc(n-4,p+2);
	}
	if(n%6==5)
	{
		for(int i=1;i<=n;i+=3)for(int j=1;j<=n;j+=2)c(i,j),c(i+1,j);
	}
	if(n%6==3)
	{
		for(int j=1;j<=n;j+=3)c(1,j),c(1,j+1),c(3,j),c(3,j+1);
		for(int i=5;i<=n;i+=3)for(int j=1;j<=n;j+=2)c(i,j),c(i+1,j);
	}
}
inline void solve()
{
	cin>>n;for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)a[i][j]=0;
	calc(n,1);for(int i=1;i<=n;i++,cout<<'\n')for(int j=1;j<=n;j++)cout<<(a[i][j]?'#':'.');
}

bool ED;

signed main()
{
	int time_st=clock();
	cerr<<(&ST-&ED)/1024.0/1024<<endl;ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int T;cin>>T;while(T--)solve();
	cerr<<(clock()-time_st)/1e6<<endl;return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3984kb

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: 0
Accepted
time: 1ms
memory: 3976kb

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:

ok all tests correct (50 test cases)

Test #3:

score: 0
Accepted
time: 2ms
memory: 4032kb

input:

39
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

output:

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

result:

ok all tests correct (39 test cases)

Test #4:

score: 0
Accepted
time: 1ms
memory: 3980kb

input:

11
90
91
92
93
94
95
96
97
98
99
100

output:

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

result:

ok all tests correct (11 test cases)

Test #5:

score: 0
Accepted
time: 1ms
memory: 3916kb

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed