QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#59176#2540. Build The GridHongzy#WA 2ms3644kbC++824b2022-10-28 15:09:412022-10-28 15:09:43

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-28 15:09:43]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3644kb
  • [2022-10-28 15:09:41]
  • 提交

answer

#include<bits/stdc++.h>
#define M 505
using namespace std;
void Rd(int &res) {
	res=0;
	char c;
	int fl=1;
	while(c=getchar(),c<48)if(c=='-')fl=-1;
	do res=(res<<1)+(res<<3)+(c^48);
	while(c=getchar(),c>=48);
	res*=fl;
}
int n,a[M][M];
int main() {
	Rd(n);
	int l=0,r=n-1;
	for(int i=0; i<n; i++) {
		if((n%3==0)&&(i==n-1)&&(n!=3)) {
			for(int j=0; j<n; j++) {
				if(n-j<=l)a[i][j]=1;
				else a[i][j]=0;
			}
		} else {
			if(i%3==0) {
				for(int j=0; j<n; j++) {
					if(n-j<=l)a[i][j]=1;
					else a[i][j]=0;
				}
				l++;
			} else {
				for(int j=0; j<n; j++) {
					if(j<r)a[i][j]=1;
					else a[i][j]=0; 
				}
				r--;
			}
		}
	}
	for(int i=0; i<n; i++) {
		for(int j=0; j<n; j++) {
			if(a[i][j]==0)printf("W");
			else printf("B");
		}
		puts("");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3

output:

WWW
BBW
BWW

result:

ok accepted

Test #2:

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

input:

2

output:

WW
BW

result:

ok accepted

Test #3:

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

input:

4

output:

WWWW
BBBW
BBWW
WWWB

result:

wrong answer Q is not a permutation