QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#410358#2540. Build The GridKevin5307WA 0ms3684kbC++23554b2024-05-13 22:00:092024-05-13 22:00:10

Judging History

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

  • [2024-05-13 22:00:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-05-13 22:00:09]
  • 提交

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 len;
		if(i==1) len=n-1;
		else if(i==2) len=0;
		else if(i==n&&n%2) len=1;
		else if(i&1) len=n-i;
		else len=n-i+2;
		for(int j=1;j<=len;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;
}

詳細信息

Test #1:

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

input:

3

output:

BBW
WWW
WBW

result:

ok accepted

Test #2:

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

input:

2

output:

BW
WW

result:

ok accepted

Test #3:

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

input:

4

output:

BBBW
WWWW
WWBW
WBBW

result:

ok accepted

Test #4:

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

input:

5

output:

BBBBW
WWWWW
WWBBW
WBBBW
WWWBW

result:

ok accepted

Test #5:

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

input:

7

output:

BBBBBBW
WWWWWWW
WWBBBBW
WBBBBBW
WWWWBBW
WWWBBBW
WWWWWBW

result:

wrong answer there are no white cells around a black cell