QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#673455#4328. DugputQingyu0 15ms24420kbC++232.4kb2024-10-24 22:29:092024-10-24 22:43:52

Judging History

你现在查看的是测评时间为 2024-10-24 22:43:52 的历史记录

  • [2024-10-24 22:48:29]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:17ms
  • 内存:24336kb
  • [2024-10-24 22:43:52]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:15ms
  • 内存:24420kb
  • [2024-10-24 22:29:10]
  • 评测
  • 测评结果:0
  • 用时:18ms
  • 内存:24344kb
  • [2024-10-24 22:29:09]
  • 提交

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) 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;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 10092kb

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:

20
12
18
4
5
5
9
7
2
7
7
42
17
10
14
11
2
9
29
14
33
13
27
20
29
10
9
11
3
5
3
19
13
12
14
10
5
12
7
2
4
5
100
31
13
9
71
15
54
69
54
35
14
2
30
28
12
7
20
3
22
2
3
8
4
16
5
16
14
6
2
4
2
3
6
25
5
25
14
16
6
2
10
3
38
22
20
24
18
6
6
3
17
100
57
9
22
84
19
25
3
19
6
14
18
3
7
19
3
4
3
32
27
13
8
28
...

result:

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

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 15ms
memory: 24420kb

input:

5
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:

165
177
93
462
663
283
438
104
4
260
4
500
406
29
223
141
136
151
28
4
26
5
21
212
112
120
450
300
92
28
4
218
5
500
286
301
117
143
40
316
327
4
211
4
579
245
434
576
458
452
118
298
5
308
5
521
230
233
226
233
198
380
99
5
58
3
500
288
329
100
477
164
241
338
5
88
5
500
313
131
294
491
140
92
7
24...

result:

wrong answer read 165 but expected 82499 (test case 1)