QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#22974#2540. Build The Gridforeverlasting#WA 2ms3700kbC++11779b2022-03-11 13:32:552022-04-30 02:12:01

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:01]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3700kb
  • [2022-03-11 13:32:55]
  • 提交

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 x=1,i=1,k=n;i<=n;--k,x^=1,i+=2)
		if(x&1)
			for(int j=n;j>n-k;--j)
				s[i][j]='W';
		else
			for(int j=1;j<=k;++j)
				s[i][j]='W';
	for(int x=1,i=2,k=1;i<=n;++k,x^=1,i+=2)
		if(x&1)
			for(int j=1;j<=k;++j)
				s[i][j]='W';
		else
			for(int j=n;j>n-k;--j)
				s[i][j]='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: 1ms
memory: 3580kb

input:

3

output:

WWW
WBB
WWB

result:

ok accepted

Test #2:

score: 0
Accepted
time: 2ms
memory: 3464kb

input:

2

output:

WW
WB

result:

ok accepted

Test #3:

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

input:

4

output:

WWWW
WBBB
WWWB
BBWW

result:

wrong answer Q is not a permutation