QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#473559#4328. DugputPorNPtree80 246ms55220kbC++142.4kb2024-07-12 09:56:492024-07-12 09:56:50

Judging History

你现在查看的是测评时间为 2024-07-12 09:56:50 的历史记录

  • [2024-10-24 22:48:15]
  • 管理员手动重测本题所有提交记录
  • 测评结果:13.634278
  • 用时:257ms
  • 内存:55164kb
  • [2024-10-24 22:43:30]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:19ms
  • 内存:24352kb
  • [2024-10-24 22:23:34]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:19ms
  • 内存:24264kb
  • [2024-10-24 22:21:01]
  • 管理员手动重测本题所有提交记录
  • 测评结果:44.882701
  • 用时:221ms
  • 内存:55084kb
  • [2024-07-25 15:13:26]
  • 管理员手动重测本题所有提交记录
  • 测评结果:60
  • 用时:241ms
  • 内存:55232kb
  • [2024-07-12 09:56:50]
  • 评测
  • 测评结果:80
  • 用时:246ms
  • 内存:55220kb
  • [2024-07-12 09:56:49]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 10005;
const int dx[] = {-1, 0, 1, 0},
          dy[] = {0, 1, 0, -1};

int vis[N][N];
string S;
int sx, sy, tx, ty;

void walk(int c) {
    if (vis[sx + dx[c]][sy + dy[c]]++) return;
    sx += dx[c], sy += dy[c], S += "URDL"[c];
}

char res[N << 1][N * 3];

signed main() {
    int id, T; scanf("%d%d", &id, &T);
    while (T--) {
        int n, m, tsx, tsy;
        scanf("%d%d%d%d%d%d", &n, &m, &sx, &sy, &tx, &ty);
        tsx = sx, tsy = sy;
        for (int i = 0; i <= n + 1; ++i) {
            for (int j = 0; j <= m + 1; ++j) {
                vis[i][j] = (i < 1 || i > n || j < 1 || j > m);
            }
        }
        S = "";
        if (n == 1) {
            while (sy < ty) walk(1);
            while (sy > ty) walk(3);
        } else if (m == 1) {
            while (sx < tx) walk(2);
            while (sx > tx) walk(0);
        } else {
            while (sx < tx) walk(2);
            while (sx > tx) walk(0);
            while (sy < ty) walk(1);
            while (sy > ty) walk(3);
        }
        if (id == 5) printf("%d\n", (int)S.size() + 1);
        else {
            assert(sx == tx && sy == ty);
            for (int i = 1; i <= n * 2 - 1; ++i) {
                for (int j = 1; j <= m * 3 - 2; ++j) res[i][j] = ' ';
            }
            for (int i = 1; i <= n * 2 - 1; i += 2) {
                for (int j = 1; j <= m * 3 - 2; j += 3) res[i][j] = 'o';
            }
            sx = tsx, sy = tsy;
            res[tsx * 2 - 1][tsy * 3 - 2] = '*';
            res[tx * 2 - 1][ty * 3 - 2] = '*';
            for (auto c : S) {
                if (c == 'R') {
                    res[sx * 2 - 1][sy * 3 - 1] = res[sx * 2 - 1][sy * 3] = '-';
                    ++sy;
                } else if (c == 'L') {
                    --sy;
                    res[sx * 2 - 1][sy * 3 - 1] = res[sx * 2 - 1][sy * 3] = '-';
                } else if (c == 'D') {
                    res[sx * 2][sy * 3 - 2] = '|';
                    ++sx;
                } else {
                    --sx;
                    res[sx * 2][sy * 3 - 2] = '|';
                }
            }
            for (int i = 1; i <= n * 2 - 1; ++i) {
                for (int j = 1; j <= m * 3 - 2; ++j) putchar(res[i][j]);
                puts("");
            }
        }
    }
    return 0;
}

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 0ms
memory: 16104kb

input:

1
1562
15 6 1 6 15 1
15 6 5 6 11 1
15 6 15 2 1 5
15 6 1 6 1 3
15 6 15 6 11 6
15 6 1 1 4 2
15 6 2 1 9 2
15 6 4 5 9 4
15 6 4 5 4 6
15 6 9 2 3 2
15 6 9 2 6 5
2 41 1 41 2 1
2 41 1 24 2 9
2 41 2 2 1 10
2 41 1 1 1 14
2 41 2 1 1 10
2 41 2 16 2 17
2 41 1 28 2 35
2 41 2 9 1 36
2 41 1 18 ...

output:

o  o  o  o  o  *
               |
o  o  o  o  o  o
               |
o  o  o  o  o  o
               |
o  o  o  o  o  o
               |
o  o  o  o  o  o
               |
o  o  o  o  o  o
               |
o  o  o  o  o  o
               |
o  o  o  o  o  o
               |
o  o  o  o  o  o
           ...

result:

points 1.0 correct (test case 1562)

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #2:

score: 20
Accepted
time: 15ms
memory: 55164kb

input:

2
1562
500 1 1 1 500 1
500 1 52 1 76 1
500 1 24 1 243 1
500 1 1 1 386 1
500 1 1 1 10 1
500 1 340 1 117 1
500 1 298 1 363 1
500 1 300 1 103 1
500 1 370 1 383 1
12 83 12 1 12 83
12 83 12 27 12 65
12 83 1 22 1 78
12 83 1 83 12 69
12 83 1 83 2 83
12 83 1 83 2 60
12 83 10 83 11 14
12 83...

output:

*
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
o
|
...

result:

points 1.0 correct (test case 1562)

Subtask #3:

score: 20
Accepted

Dependency #2:

100%
Accepted

Test #3:

score: 20
Accepted
time: 21ms
memory: 53096kb

input:

3
1172
500 3 500 3 1 3
500 3 332 1 425 1
500 3 390 1 270 3
500 3 1 1 293 3
500 3 500 1 284 1
500 3 1 3 55 2
500 3 314 1 457 2
500 3 68 2 261 2
500 3 68 2 69 3
500 3 299 2 376 2
500 3 299 2 299 1
500 3 500 1 1 1
500 3 103 1 300 1
500 3 142 1 113 1
500 3 1 1 76 3
500 3 1 1 439 1
500 ...

output:

o  o  *
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
      |
o  o  o
    ...

result:

points 1.0 correct (test case 1172)

Subtask #4:

score: 0
Wrong Answer

Dependency #3:

100%
Accepted

Test #4:

score: 0
Wrong Answer
time: 246ms
memory: 55220kb

input:

4
1562
165 500 1 500 165 500
165 500 78 500 1 401
165 500 165 469 104 500
165 500 1 1 165 298
165 500 165 1 1 499
165 500 165 1 4 122
165 500 8 1 85 361
165 500 112 191 152 254
165 500 112 191 114 190
165 500 49 106 64 350
165 500 49 106 48 108
22 500 22 500 22 1
22 500 20 1 1 387
22 ...

output:

o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  ...

result:

wrong answer invalid map: (1, 1) is  , but it should be either o or * (test case 1349)

Subtask #5:

score: 20
Accepted