QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#320070#8217. King's Dinnerucup-team052#AC ✓5ms3776kbC++231.8kb2024-02-03 13:36:322024-02-03 13:36:32

Judging History

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

  • [2024-02-03 13:36:32]
  • 评测
  • 测评结果:AC
  • 用时:5ms
  • 内存:3776kb
  • [2024-02-03 13:36:32]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
void print(vector<int> x){for(int i=0;i<(int)x.size();i++) printf("%d%c",x[i]," \n"[i==(int)x.size()-1]);}
#define N 105
int a[N][N],n;
void push(int x,int y,int o)
{
	if(o==1) a[x][y]=a[x][y+1]=1;
	else a[x][y]=a[x+1][y]=1;
}
void solve(int n,int x,int y)
{
	if(n%2==0)
	{
		if(n%3==0)
		{
			for(int i=0;i<n;i+=3)
			{
				for(int j=0;j<n;j+=2) push(x+i,y+j,0);
			}
		}
		else if(n%3==1)
		{
			for(int i=0;i+4<n;i+=3)
			{
				for(int j=0;j<n;j+=2) push(x+i,y+j,0);
			}
			for(int j=0;j+2<n;j+=3) push(x+n-4,y+j,1),push(x+n-2,y+j,1);
		}
		else
		{
			for(int i=0;i+2<n;i+=3)
			{
				for(int j=0;j<n;j+=2) push(x+i,y+j,0);
			}
			for(int j=0;j+2<n;j+=3) push(x+n-2,y+j,1);
		}
		return ;
	}
	if(n==1) return ;
	if(n==3)
	{
		push(x,y,0);
		return ;
	}
	if(n==5)
	{
		push(x,y,0),push(x,y+2,1),push(x+3,y,1),push(x+2,y+3,0);
		return ;
	}
	for(int j=0;j+3<n;j+=2) push(x,y+j,0);
	for(int i=0;i+3<n;i+=2) push(x+i,y+n-3,1);
	for(int j=3;j<n;j+=2) push(x+n-3,y+j,0);
	for(int i=3;i<n;i+=2) push(x+i,y,1);
	solve(n-6,x+3,y+3);
}
void work()
{
	n=read();
	n++;
	memset(a,0,sizeof(a));
	solve(n,0,0);
	for(int i=0;i+1<n;i++)
	{
		for(int j=0;j+1<n;j++) printf("%c",".#"[a[i][j]]);
		cout<<"\n";
	}
}
signed main()
{
	int T=read(); while(T--) work();
	return 0;
}



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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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: 5ms
memory: 3760kb

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: 3ms
memory: 3776kb

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: 3724kb

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed