QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#320271#8217. King's Dinnerucup-team266#WA 1ms3712kbC++234.2kb2024-02-03 15:04:482024-02-03 15:04:49

Judging History

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

  • [2024-02-03 15:04:49]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3712kb
  • [2024-02-03 15:04:48]
  • 提交

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];
int main()
{
	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));
			int a=(n-2)/2;
			int b=(n+2)/2;
			for(int i=1;i<=a;i++)
				for(int j=1;j<=b;j++)
					if(j%2&&i%3)
						ans[i][j]=1;
			for(int i=a+1;i<=n;i++)
				for(int j=1;j<=a;j++)
					if(i%2==0&&j%3)
						ans[i][j]=1;
			for(int i=1;i<=b;i++)
				for(int j=b+1;j<=n;j++)
					if(i%2&&(n-j)%3!=2)
						ans[i][j]=1;
			for(int i=b+1;i<=n;i++)
				for(int j=a+1;j<=n;j++)
					if((n-i)%3!=2&&j%2==0)
						ans[i][j]=1;
			ans[n/2][n/2]=ans[n/2][n/2+1]=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==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));
			for(int i=1;i<=n;i++)
				for(int j=1;j<=n;j++)
					if(i<=n-4||j<=n-4)
						if(j!=n)
							if(i%2&&j%3!=0)
								ans[i][j]=1;
			for(int i=1;i<=n-4;i++)
				if(i%3)
					ans[i][n]=1;
			ans[n][n]=ans[n-1][n]=1;
			ans[n-3][n-1]=ans[n-3][n]=1;
			ans[n-3][n-3]=ans[n-2][n-3]=1;
			ans[n][n-3]=ans[n][n-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';
			}
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3712kb

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 = 20, pans = 19 (test case 10)