QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#22977#2540. Build The Gridforeverlasting#WA 3ms3708kbC++11714b2022-03-11 13:51:162022-04-30 02:12:10

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 02:12:10]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3708kb
  • [2022-03-11 13:51:16]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define RG 
#define LL long long
#define gc getchar
const int mxn=5010;
int n;
char s[mxn][mxn];
inline int rd(){
	int s=0,w=1,ch=gc();
	while(ch<'0'||ch>'9'){
		if(ch=='-')w=-1;
		ch=gc();
	}
	while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
	return s*w;
}
int main()
{
	n=rd();
	for(int i=1;i<=n;++i) s[n][i]='W';
	for(int i=n-2,k=n-1;i>0;--k,i-=2)
	{
		for(int j=1;j<k;++j) s[i][j]='W';
		s[i][n-1]='W';
	}
	for(int i=n-1,k=1;i>0;++k,i-=2)
	{
		for(int j=1;j<k;++j) s[i][j]='W';
		s[i][n-1]='W';
	}
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			if(s[i][j]!='W')
				s[i][j]='B';
	for(int i=1;i<=n;++i) puts(s[i]+1);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3584kb

input:

3

output:

WWB
BWB
WWW

result:

ok accepted

Test #2:

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

input:

2

output:

WB
WW

result:

ok accepted

Test #3:

score: 0
Accepted
time: 3ms
memory: 3584kb

input:

4

output:

WBWB
WWWB
BBWB
WWWW

result:

ok accepted

Test #4:

score: 0
Accepted
time: 3ms
memory: 3544kb

input:

5

output:

WWBWB
WBBWB
WWWWB
BBBWB
WWWWW

result:

ok accepted

Test #5:

score: 0
Accepted
time: 3ms
memory: 3600kb

input:

7

output:

WWWBBWB
WWBBBWB
WWWWBWB
WBBBBWB
WWWWWWB
BBBBBWB
WWWWWWW

result:

ok accepted

Test #6:

score: -100
Wrong Answer
time: 3ms
memory: 3708kb

input:

9

output:

WWWWBBBWB
WWWBBBBWB
WWWWWBBWB
WWBBBBBWB
WWWWWWBWB
WBBBBBBWB
WWWWWWWWB
BBBBBBBWB
WWWWWWWWW

result:

wrong answer there are no white cells around a black cell