QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410341#2540. Build The GridKevin5307WA 1ms3740kbC++23524b2024-05-13 21:49:502024-05-13 21:49:50

Judging History

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

  • [2024-05-13 21:49:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3740kb
  • [2024-05-13 21:49:50]
  • 提交

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++)
	{
		int a=(i&1)?(n-1-i/2):(i/2-1);
		if(i&1)
			for(int j=1;j<=a;j++)
				grid[i][j]='B';
		else
			for(int j=1;j<=a;j++)
				grid[i][n-j]='B';
	}
	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: 100
Accepted
time: 0ms
memory: 3740kb

input:

3

output:

BBW
WWW
BWW

result:

ok accepted

Test #2:

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

input:

2

output:

BW
WW

result:

ok accepted

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3672kb

input:

4

output:

BBBW
WWWW
BBWW
WWBW

result:

wrong answer white cells are not connected