QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#59174#2540. Build The Gridjustin_holmes#WA 2ms3592kbC++1.1kb2022-10-28 14:49:172022-10-28 14:49:21

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 14:49:21]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3592kb
  • [2022-10-28 14:49:17]
  • 提交

answer

#include<bits/stdc++.h>
#define mod 1000000007
#define maxn 200010
using namespace std;
typedef long long ll;
ll read()
{
    ll x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n;
char ans[505][505];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main()
{
    n=read();
    for(int i=1;i<=n;i++)
      for(int j=1;j<=n;j++)  ans[i][j]='W';
    int x=1,y=1,dir=0;
    int len=n-1,op=0,now=0;
    while(len>1)
    {
        ans[x][y]='B';now++;
        if(now==len)
        {
            if(op==0)
            {
                op=1;   
                now=1;
                dir=(dir+1)%4;
            }
            else{
                now=1;
                dir=(dir+1)%4;
                len--;
            }
        }
        x+=dx[dir];y+=dy[dir];
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            printf("%c",ans[i][j]);
        }
        puts("");
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3592kb

input:

3

output:

BWW
BBW
WWW

result:

ok accepted

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3560kb

input:

2

output:

WW
WW

result:

wrong answer P is not a permutation