QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#95094#5572. GridlandiaSEM_PRESSAO_pedroteosousa#WA 2ms3412kbC++231.3kb2023-04-09 03:42:102023-04-09 03:42:13

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-09 03:42:13]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3412kb
  • [2023-04-09 03:42:10]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio (0); cin.tie (0);

int n;

void solve () {
    cin >> n;

    if (n == 1) {
        cout << "L\n";
        return;
    }
    if (n == 2) {
        cout << "LU\nDR\n";
        return;
    }

    if (n & 1) {
        vector a (n, vector<char> (n, '.'));
        a[0][0] = 'U';
        for (int j = 1; j < n; j++) a[0][j] = 'R';
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < n; j += 2) a[i][j] = 'D';
        }
        a[1][0] = a[1][1] = 'L';
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) cout << a[i][j] << " ";
            cout << "\n";
        }
    }
    else {
        vector a (n, vector<char> (n, '.'));
        a[0][0] = 'L';
        a[0][1] = 'U';
        for (int j = 2; j < n; j++) a[0][j] = 'R';

        for (int i = 1; i < n; i++)
            for (int j = 1; j < n; j += 2) a[i][j] = 'D';

        a[1][0] = a[1][1] = 'R';
        
        for (int i = 3; i < n; i += 2) a[i][0] = 'L';

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) cout << a[i][j] << " ";
            cout << "\n";
        }
    }
}

signed main () {
    IOS;
    solve ();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

L

result:

ok answer = 1

Test #2:

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

input:

2

output:

LU
DR

result:

ok answer = 4

Test #3:

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

input:

3

output:

U R R 
L L D 
D . D 

result:

wrong answer Line [name=Line] equals to "U R R ", doesn't correspond to pattern "[ULDR.]+"