QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#320304#8217. King's Dinnerucup-team266#AC ✓3ms3756kbC++234.0kb2024-02-03 15:27:362024-02-03 15:27:36

Judging History

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

  • [2024-02-03 15:27:36]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3756kb
  • [2024-02-03 15:27:36]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int ans[105][105];
void solve(int x,int y,int n)
{
	if(n==4)
	{
		ans[x+1][y+1]=ans[x+1][y+2]=1;
		ans[x+1][y+4]=ans[x+2][y+4]=1;
		ans[x+3][y+1]=ans[x+4][y+1]=1;
		ans[x+4][y+3]=ans[x+4][y+4]=1;
		return ;
	}
	if(n==2)
	{
		ans[x+1][y+1]=ans[x+1][y+2]=1;
		return ;
	}
	int a=n/2-1;
	for(int i=1;i<=a;i++)
	{
		ans[x+1][y+i+i-1]=ans[x+2][y+i+i-1]=1;
		ans[x+i+i-1][y+n]=ans[x+i+i-1][y+n-1]=1;
		ans[x+n-i-i+2][y+1]=ans[x+n-i-i+2][y+2]=1;
		ans[x+n][y+i+i+2]=ans[x+n-1][y+i+i+2]=1;
	}
	solve(x+3,y+3,n-6);
}
int main()
{
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		if(n%6==5)
		{
			for(int i=1;i<=n;i++)
			{
				for(int j=1;j<=n;j++)
					if(i%2&&j%3!=0)
						cout<<"#";
					else
						cout<<".";
				cout<<'\n';
			}
		}
		if(n%6==3)
		{
			for(int i=1;i<=n;i++)
			{
				for(int j=1;j<=n;j++)
					if(j<=n-3)
					{
						if(i%2&&j%3!=0)
							cout<<"#";
						else
							cout<<".";
					}
					else
					{
						if(j%2&&i%3!=0)
							cout<<"#";
						else
							cout<<".";
					}
				cout<<'\n';
			}
		}
		if(n%6==1)
		{
			for(int i=1;i<=n;i++)
			{
				for(int j=1;j<=n;j++)
					if(j<=n-1)
					{
						if(i%2&&j%3!=0)
							cout<<"#";
						else
							cout<<".";
					}
					else
					{
						if(j%2&&i%3!=0&&i!=n)
							cout<<"#";
						else
							cout<<".";
					}
				cout<<'\n';
			}
		}
		if(n%6==2)
		{
			memset(ans,0,sizeof(ans));
			solve(0,0,n);
			for(int i=1;i<=n;i++)
			{
				for(int j=1;j<=n;j++)
					if(ans[i][j])
						cout<<"#";
					else
						cout<<".";
				cout<<'\n';
			}
		}
		if(n%12==6)
		{
			memset(ans,0,sizeof(ans));
			int x=n/2;
			for(int i=1;i<=x;i++)
				for(int j=1;j<=x;j++)
					if(i%3&&j%2)
						ans[i][j]=1;
			for(int i=x+1;i<=n;i++)
				for(int j=1;j<=x;j++)
					if(i%2==0&&j%3)
						ans[i][j]=1;
			for(int i=1;i<=x;i++)
				for(int j=x+1;j<=n;j++)
					if(i%2&&(n-j)%3!=2)
						ans[i][j]=1;
			for(int i=x+1;i<=n;i++)
				for(int j=x+1;j<=n;j++)
					if(j%2==0&&(n-i)%3!=2)
						ans[i][j]=1;
			for(int i=1;i<=n;i++)
			{
				for(int j=1;j<=n;j++)
					if(ans[i][j])
						cout<<"#";
					else
						cout<<".";
				cout<<'\n';
			}
		}
		if(n%12==0)
		{
			int a=n/2-2;
			int b=n/2+2;
			memset(ans,0,sizeof(ans));
			int x=n/2;
			for(int i=1;i<=b;i++)
				for(int j=1;j<=a;j++)
					if(i%3&&j%2)
						ans[i][j]=1;
			for(int i=b+1;i<=n;i++)
				for(int j=1;j<=b;j++)
					if(i%2==0&&j%3)
						ans[i][j]=1;
			for(int i=1;i<=a;i++)
				for(int j=a+1;j<=n;j++)
					if(i%2&&(n-j)%3!=2)
						ans[i][j]=1;
			for(int i=a+1;i<=n;i++)
				for(int j=b+1;j<=n;j++)
					if(j%2==0&&(n-i)%3!=2)
						ans[i][j]=1;
			ans[n/2-1][n/2-1]=ans[n/2-1][n/2]=1;
			ans[n/2+1][n/2-1]=ans[n/2+2][n/2-1]=1;
			ans[n/2-1][n/2+2]=ans[n/2][n/2+2]=1;
			ans[n/2+2][n/2+1]=ans[n/2+2][n/2+2]=1;
			for(int i=1;i<=n;i++)
			{
				for(int j=1;j<=n;j++)
					if(ans[i][j])
						cout<<"#";
					else
						cout<<".";
				cout<<'\n';
			}
		}
		if(n%6==4)
		{
			memset(ans,0,sizeof(ans));
			solve(0,0,n);
			for(int i=1;i<=n;i++)
			{
				for(int j=1;j<=n;j++)
					if(ans[i][j])
						cout<<"#";
					else
						cout<<".";
				cout<<'\n';
			}
		}
	}
	return 0;
}

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

详细

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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

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: 2ms
memory: 3732kb

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed