QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#22974 | #2540. Build The Grid | foreverlasting# | WA | 2ms | 3700kb | C++11 | 779b | 2022-03-11 13:32:55 | 2022-04-30 02:12:01 |
Judging History
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;
}
詳細信息
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