QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#142072#5572. Gridlandiaammardab3an#WA 1ms3544kbC++201.3kb2023-08-18 13:46:302023-08-18 13:46:32

Judging History

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

  • [2023-08-18 13:46:32]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3544kb
  • [2023-08-18 13:46:30]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define endl '\n'

int main()
{

    int n;
    cin >> n;

    vector<string> grid(n, string(n, '.'));

    for(int i = 0; i < n; i++)
    for(int j = 0; j < n; j++){
        if(((i+1)/2 + j)%2 == 0){
            grid[i][j] = 'D';
        }
    }

    if(n%2==0){
        for(int i = 0; i < n; i += 2){
            if((i/2)%2==0){
                assert(grid[i][n-1]=='.');
                grid[i][n-1] = 'R';
            }
            else{
                assert(grid[i][0]=='.');
                grid[i][0] = 'L';
            }
        }
    }
    else {
        if(n >= 5) for(int i = 5; i < n; i+=4){
            assert(grid[i][0]=='.');
            assert(grid[i][n-1]=='.');
            grid[i][0]='L';
            grid[i][n-1] = 'R';
        }
        if(n >= 2) for(auto i : {2}){
            assert(grid[i][0]=='.');
            assert(grid[i][n-1]=='.');
            grid[i][0]='L';
            grid[i][n-1] = 'R';
        }
    }

    for(int i = 0; i < n; i++) if(grid[0][i]=='D'){
        grid[0][i] = 'U';
        if(n >= 2){
            assert(grid[1][i] == '.');
            grid[1][i] = 'U';
        }

    }

    for(int i = 0; i < n; i++){
        cout << grid[i] << endl;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3544kb

input:

1

output:

U

result:

ok answer = 1

Test #2:

score: 0
Accepted
time: 1ms
memory: 3432kb

input:

2

output:

UR
UD

result:

ok answer = 4

Test #3:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

3

output:

U.U
UDU
LDR

result:

ok answer = 8

Test #4:

score: 0
Accepted
time: 0ms
memory: 3432kb

input:

4

output:

U.UR
UDUD
LD.D
D.D.

result:

ok answer = 12

Test #5:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

5

output:

U.U.U
UDUDU
LD.DR
D.D.D
D.D.D

result:

ok answer = 18

Test #6:

score: 0
Accepted
time: 1ms
memory: 3496kb

input:

6

output:

U.U.UR
UDUDUD
LD.D.D
D.D.D.
D.D.DR
.D.D.D

result:

ok answer = 24

Test #7:

score: -100
Wrong Answer
time: 1ms
memory: 3496kb

input:

7

output:

U.U.U.U
UDUDUDU
LD.D.DR
D.D.D.D
D.D.D.D
LD.D.DR
.D.D.D.

result:

wrong answer Walls from cells (1, 5), (1, 6) overlap