QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#95806#5572. Gridlandiaaguo123WA 2ms3392kbC++141.4kb2023-04-11 22:17:032023-04-11 22:17:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-11 22:17:07]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3392kb
  • [2023-04-11 22:17:03]
  • 提交

answer

#include<iostream>
#include<string>
#include <cstring>
#include <vector>
#include<algorithm>
using namespace  std;
typedef  long long LL;
typedef  pair<int,int> PII;
int n;
char g[1100][1100];
int main()
{
    cin>>n;
    char s;
    char str[]={'L','U','R','D'};

    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            g[i][j]='.';
    g[1][1]='L',g[1][2]='U',g[2][1]='D',g[2][2]='R';
    for(int i=3;i<=n;i++)g[1][i]='R';
    for(int i=2;i<=n;i++){
       for(int j=1;j<=n;j++) {
           if (g[i][j] == '.') {
               bool st[4] = {0};
               if (g[i - 1][j] == 'L')st[1] = st[0] = 1;
               //if (g[i - 1][j] == 'U')st[0] = st[2] = 1;
               if (g[i - 1][j] == 'R')st[1] = st[2] = 1;
               if (g[i - 1][j] == 'D')st[0] = st[2]=st[1] = 1;
               //if (g[i][j - 1] == 'L')st[1] = st[3] = 1;
               if (g[i][j - 1] == 'U')st[0] = st[1] = 1;
               if (g[i][j - 1] == 'R')st[1] = st[3]=st[0] = 1;
               if (g[i][j - 1] == 'D')st[0] = st[3] = 1;

               if(g[i-1][j+1]=='L')st[1]=st[2]=1;
               if(g[i-1][j+1]=='D')st[1]=st[2]=1;
               for (int k = 0; k < 4; k++)
                   if (!st[k])g[i][j] = str[k];
           }
       }
    }
    for(int i=1;i<=n;i++) {
        for (int j = 1; j <= n; j++)
            cout << g[i][j];
        cout << endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

L

result:

ok answer = 1

Test #2:

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

input:

2

output:

LU
DR

result:

ok answer = 4

Test #3:

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

input:

3

output:

LUR
DR.
D.D

result:

wrong answer jury has the better answer: jans = 8, pans = 7