QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410365#2540. Build The GridKevin5307WA 0ms3572kbC++23556b2024-05-13 22:13:432024-05-13 22:13:44

Judging History

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

  • [2024-05-13 22:13:44]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3572kb
  • [2024-05-13 22:13:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
char grid[505][505];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			grid[i][j]='W';
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if((n-max(i,j))%2)
				grid[i][j]='B';
	for(int i=2;i<=n;i+=2)
		for(int j=1;j<=i/2;j++)
			for(int k=1;k<=i;k++)
				swap(grid[j][k],grid[i+1-j][i+1-k]);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
			putchar(grid[i][j]);
		putchar(10);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3572kb

input:

3

output:

BBW
BWW
WWW

result:

wrong answer there are no white cells around a black cell