QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#269830#5101. Crystal CrosswindjuampiTL 4415ms177344kbPython31.6kb2023-11-30 02:59:062023-11-30 02:59:06

Judging History

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

  • [2023-11-30 02:59:06]
  • 评测
  • 测评结果:TL
  • 用时:4415ms
  • 内存:177344kb
  • [2023-11-30 02:59:06]
  • 提交

answer

import sys

sys.setrecursionlimit(1000000)

def doit(x, y):
    ch = g[y][x] if (1 <= x <= X and 1 <= y <= Y) else '.'
    if ch == ' ':
        return
    for i in range(N):
        x2 = x + (wm[i] if ch == '.' else -wm[i])
        y2 = y + (wn[i] if ch == '.' else -wn[i])
        
        if 1 <= x2 <= X and 1 <= y2 <= Y:
            if g[y2][x2] == ' ':
                g[y2][x2] = ch
                doit(x2, y2)


while True:
    try:
        X, Y, N = map(int, input().split())
        g = [[' ' for _ in range(X + 1)] for _ in range(Y + 1)]
        wm = [0] * N
        wn = [0] * N
        for i in range(N):
            line = input().split()
            wm[i] = int(line[0])
            wn[i] = int(line[1])
            B = int(line[2])
            pos = 3
            for j in range(B):  
                x = int(line[pos])
                pos = pos + 1
                y = int(line[pos])
                pos = pos + 1
                g[y][x] = '#'
                x2 = x - wm[i]
                y2 = y - wn[i]
                if 1 <= x2 <= X and 1 <= y2 <= Y:
                    g[y2][x2] = '.'

        for y in range(-Y, 2 * Y + 1):
            for x in range(-X, 2 * X + 1):
                doit(x, y)

        for y in range(1, Y + 1):
            for x in range(1, X + 1):
                print(g[y][x] if (g[y][x] != ' ') else '.', end='')
            print()
        print()

        for y in range(1, Y + 1):
            for x in range(1, X + 1):
                print(g[y][x] if (g[y][x] != ' ') else '#', end='')
            print()
    except EOFError:
        break

详细

Test #1:

score: 100
Accepted
time: 9ms
memory: 9164kb

input:

4 1 1
0 1 2 1 1 3 1

output:

#.#.

#.#.

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 9ms
memory: 9092kb

input:

4 4 2
1 0 4 2 4 2 1 1 3 1 2
-1 0 4 4 3 4 2 3 1 3 4

output:

.##.
####
####
.##.

.##.
####
####
.##.

result:

ok 9 lines

Test #3:

score: 0
Accepted
time: 15ms
memory: 9168kb

input:

8 12 1
-1 -4 10 5 7 2 4 1 5 5 11 1 6 5 3 8 11 5 1 1 4 7 3

output:

....#...
........
....#.#.
##......
#.......
#.......
....#...
........
........
........
....#..#
........

....#...
........
..#####.
##......
#.......
#.......
...##.#.
........
........
........
....#..#
........

result:

ok 25 lines

Test #4:

score: 0
Accepted
time: 15ms
memory: 9080kb

input:

4 4 2
1 0 6 2 1 1 2 1 3 4 3 2 4 4 2
-1 0 6 4 2 2 2 2 3 3 1 3 4 4 3

output:

.##.
##.#
##.#
.##.

.##.
##.#
##.#
.##.

result:

ok 9 lines

Test #5:

score: 0
Accepted
time: 15ms
memory: 9072kb

input:

8 10 1
-6 -6 25 7 3 8 5 8 6 4 5 4 4 3 2 5 3 6 8 5 4 1 9 1 8 7 10 8 4 2 7 3 9 2 4 3 10 4 6 2 10 3 6 8 8 6 10 4 3 6 1 7 9

output:

.....#..
..#.....
...##.#.
.#.##..#
...#...#
..##...#
.#......
#....#.#
#.#...#.
.##..##.

.....#..
.##.....
#..##.#.
##.##..#
...#...#
..##...#
.#......
#....#.#
#.#...#.
.##..##.

result:

ok 21 lines

Test #6:

score: 0
Accepted
time: 13ms
memory: 9176kb

input:

30 25 2
9 -15 229 27 8 13 20 25 20 15 9 7 16 23 4 2 18 20 21 21 24 19 24 2 23 19 18 25 7 11 6 7 5 4 12 15 25 13 1 28 20 9 1 8 8 17 21 3 1 21 20 14 20 1 12 14 16 9 5 19 17 7 24 11 20 15 18 15 11 28 12 9 15 19 20 30 15 4 17 10 13 4 9 20 24 2 24 13 9 20 25 25 24 11 14 20 19 24 12 9 9 3 5 27 14 19 12 12...

output:

..##...##..##....####.....##..
..........###............#....
.......###.##.#.#.....##..##.#
...###.....#..#.....#.#...#.#.
#.##..#.#.#...#.......#..#.#..
#.........#........##..#..#...
...#....#.#....#.##.....#..#..
.......##...##.#..#.#.#..##.#.
...#....#####.#.....##.###....
.#..##.......#...##.#...

result:

ok 51 lines

Test #7:

score: 0
Accepted
time: 6ms
memory: 9180kb

input:

20 20 3
-4 -3 53 18 20 2 10 7 5 17 18 14 6 14 8 13 19 9 18 17 16 20 15 3 20 7 2 8 7 17 6 1 19 20 7 7 6 13 1 18 16 19 14 8 8 19 20 8 20 7 18 2 9 1 4 16 20 2 17 19 19 15 13 20 12 18 10 20 19 8 12 17 13 17 10 18 18 12 19 9 19 20 3 20 4 1 20 20 6 8 5 19 18 17 17 20 16 16 7 19 17 18 14 2 1 19 6 18 8
-12 ...

output:

.#.....#...##.......
......#..#..........
...#........#.#....#
#..........#...#...#
......##.....#......
......##.....#..#.##
.....#.#.......#...#
.......#.#...#...#..
.#.##......#........
.#.....#.#......##..
......#.#.#..#......
.......##......#...#
...#......#####.#...
.......#..#.#.#..##.
..#......

result:

ok 41 lines

Test #8:

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

input:

30 25 3
-20 0 192 26 25 24 20 5 5 22 25 24 25 5 10 27 25 21 8 20 24 20 4 14 17 12 19 17 19 5 19 3 14 16 4 22 23 18 11 21 23 27 7 11 6 3 8 25 4 29 21 28 12 18 21 27 21 23 16 26 13 25 9 15 2 23 24 28 6 26 21 22 21 17 23 19 17 30 12 24 12 26 16 24 5 21 2 25 12 30 24 18 25 30 14 30 7 26 24 25 21 29 17 2...

output:

.#.#...........##..#.##..#.##.
........#.....##...##....##.#.
..##.......#..#.......##.....#
.#...#.........#...#.#..#...#.
...##....#...........#.#..###.
..........#..........#.....###
...#..#....#.#....##....#.##.#
#.#.....#........#..#....#..#.
...##.......#..##....#..#.....
....#.....#......#......

result:

ok 51 lines

Test #9:

score: 0
Accepted
time: 13ms
memory: 9112kb

input:

20 20 1
5 5 29 4 17 16 18 9 4 2 7 1 11 13 9 8 19 13 10 10 1 3 6 8 14 8 6 15 17 13 17 5 10 5 15 1 17 16 8 13 6 11 7 1 18 5 1 19 15 7 17 2 5 12 19 14 11 13 7 1 2

output:

....#....#..........
#...................
....................
........#...........
.#..................
..#....#....#.......
.#........#.#.......
...............#....
............#.......
....#.......#.......
#............#......
....................
....................
.......#............
....#....

result:

ok 41 lines

Test #10:

score: 0
Accepted
time: 14ms
memory: 9120kb

input:

30 25 1
-9 0 55 8 24 2 8 1 4 3 12 6 18 1 12 19 15 26 24 13 20 1 20 18 6 9 14 5 2 13 13 24 11 7 15 11 5 19 11 26 19 14 7 29 7 15 5 19 14 27 7 26 23 12 5 12 14 15 9 12 9 11 24 3 18 3 1 8 14 30 19 25 14 7 12 23 11 7 21 3 25 21 17 23 18 11 12 14 8 4 2 30 7 24 21 28 5 18 12 11 15 18 10 16 18 2 1 30 15 20...

output:

.##...........................
...##.........................
..............................
#.............................
..........##..#............#..
.................#............
.............#............#.##
.#...........#................
...........#..#...............
.................#......

result:

ok 51 lines

Test #11:

score: 0
Accepted
time: 14ms
memory: 9396kb

input:

35 45 2
2 -35 526 24 12 21 34 20 7 22 18 35 39 35 1 2 28 22 13 12 23 17 8 8 32 33 21 23 16 34 41 26 15 9 19 35 41 19 23 19 5 29 8 28 41 10 41 30 22 10 35 3 20 20 16 13 26 1 9 32 32 17 34 11 8 14 31 4 36 31 31 32 33 12 36 12 38 22 28 28 4 17 17 23 17 2 32 33 6 17 9 31 27 12 12 15 34 33 8 7 35 23 9 31...

output:

...##.##...##..#...#.#..#.......#.#
...#...#......#.......##..#..#...#.
.........#........##..#.#.......#..
##.......#...#......#.#...###..#...
.##..#.#......#...##......##.......
...#....#..#.......#.....#...#..#.#
..#...##..##..#....#..###...#.....#
..........#.#...##..#.##....###.###
#.#........#...

result:

ok 91 lines

Test #12:

score: 0
Accepted
time: 14ms
memory: 9160kb

input:

30 55 1
16 20 148 10 2 16 41 9 18 24 37 18 33 13 36 17 21 10 46 4 34 17 46 24 55 17 43 25 47 11 19 5 30 20 22 18 25 12 33 11 52 15 44 18 29 28 35 14 5 23 52 12 38 3 25 26 40 16 38 18 31 18 19 10 54 21 13 6 7 14 32 28 2 25 32 25 31 12 53 12 43 26 16 20 20 5 42 21 32 23 8 29 50 26 24 23 23 29 22 8 15 ...

output:

.#............................
.........#.................#..
.............#..#.............
...............#............#.
.......#.....#................
.........#................#...
.....#........................
.....#...#...#....#...#..#....
...............#..........#...
................#.......

result:

ok 111 lines

Test #13:

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

input:

40 25 2
-26 16 173 8 4 30 18 32 12 13 14 40 1 15 23 37 22 20 20 2 1 13 1 12 11 38 9 15 21 27 13 4 1 40 18 10 24 35 21 28 8 34 3 31 21 13 7 13 2 8 11 30 7 24 15 34 15 14 24 15 18 1 5 37 9 38 17 13 19 6 21 24 1 19 16 36 5 3 21 4 10 19 25 40 14 6 23 33 2 33 16 20 2 22 16 12 6 2 7 4 8 27 7 6 1 28 16 12 ...

output:

.#.#.#.#....#....#...#.#..##.....#....##
.#..........#......#.........#..#.......
...#....#...........#............#...#..
...#...#........#.........#.............
##.......#...........#...#.........#....
..........##......##.#.......#.#.......#
.#...#......#........#....#.##........##
...#.......#....

result:

ok 51 lines

Test #14:

score: 0
Accepted
time: 36ms
memory: 9616kb

input:

40 60 8
-11 4 957 32 24 36 13 15 27 40 25 39 45 3 5 35 11 20 9 3 36 36 5 18 19 4 6 40 23 19 11 23 42 5 31 7 2 40 31 29 31 28 39 21 43 10 60 37 49 26 43 39 34 35 44 4 29 30 42 15 18 22 36 40 14 2 60 12 38 4 12 22 2 19 13 17 37 36 45 13 7 35 2 1 14 20 24 16 9 16 11 25 56 30 25 40 8 8 49 12 32 4 25 37 ...

output:

###.#####.#...##.######.#.##...###.#..#.
.#....#.###.#..#######.##..###.#.##.#..#
.#.###########..##.#......###.###...####
##.######.#..##.#####...#####.##..#....#
####.##.##.......####.#....##...#####..#
####.##.###.#.#.#..#.###..##..##..#...#.
#.####..##.###...#.....#.#..#.....##.#..
#####...#.##....

result:

ok 121 lines

Test #15:

score: 0
Accepted
time: 28ms
memory: 9388kb

input:

55 60 2
-2 -27 577 37 41 51 57 17 52 33 59 49 13 27 50 51 23 47 17 13 45 48 14 53 39 18 34 29 28 53 59 54 46 24 15 50 34 27 52 35 6 20 26 15 57 3 44 9 28 29 38 4 53 34 10 15 21 26 56 16 40 10 19 27 29 8 17 30 24 15 37 52 54 11 13 49 23 5 4 13 25 47 11 37 5 25 40 19 49 34 53 30 29 52 37 35 54 6 60 48...

output:

..#...##....#..........#.#.#.......#.......#.........##
#....##..#....#.##.#..##...#.......#.....##.##.##......
......#......#...#.#.....#...#............#.#......#.#.
...###....##.....##...........##..#........#..........#
....##...........#........#.#.##..###..##.......#....#.
#.............#...#....

result:

ok 121 lines

Test #16:

score: 0
Accepted
time: 41ms
memory: 9732kb

input:

66 75 2
55 55 1320 34 30 21 14 27 22 7 64 50 18 58 65 16 13 47 33 19 1 9 42 15 24 12 46 11 12 6 28 21 48 10 36 44 26 2 42 5 75 3 52 9 41 59 28 6 25 25 31 23 42 5 26 24 69 53 53 34 72 26 73 49 66 13 36 29 71 23 12 45 12 12 39 28 19 20 28 26 23 6 6 29 58 42 60 18 24 61 21 37 68 18 29 24 68 18 8 12 24 ...

output:

.#.#....#.#...#..###.#..#.#....#.......#..#...#...#.#.....#.#.....
.#..#..#.........#.........#.#.....#....#...#..##.#..##..........#
...#..#.......#.#.###....#..#.....##......#.#..#.#.#..#....#..#..#
..........#....#.#.....#........#..........#......#.####....##..#.
##......#.##.........####..........

result:

ok 151 lines

Test #17:

score: 0
Accepted
time: 79ms
memory: 9568kb

input:

100 155 1
17 -4 699 49 28 10 86 96 52 91 10 30 30 5 135 55 137 92 77 66 53 74 124 8 73 24 10 42 108 51 146 15 20 72 141 70 117 27 44 76 38 80 148 92 121 15 29 99 27 27 147 45 48 94 95 78 47 54 67 49 145 25 78 77 85 43 142 56 60 66 32 89 83 77 142 14 31 41 56 69 35 34 8 61 139 72 13 50 124 36 111 39 ...

output:

.............#.....................#............................#......#..........#.................
......#.....................#............................#..#................#......................
.........................................................................#...........................

result:

ok 311 lines

Test #18:

score: 0
Accepted
time: 434ms
memory: 10444kb

input:

280 355 1
-91 -330 1796 138 18 249 168 94 186 120 28 131 21 241 34 33 55 239 22 12 304 274 43 132 293 193 289 82 113 41 121 68 216 71 223 168 286 219 193 254 39 65 275 274 345 226 245 100 1 205 285 89 33 94 91 114 4 20 225 245 77 279 6 170 150 264 345 78 82 116 355 111 255 42 110 228 71 38 39 142 25...

output:

...................................................................................................#.....#...............................................................................................................................................................#..............
......................

result:

ok 711 lines

Test #19:

score: 0
Accepted
time: 1498ms
memory: 12520kb

input:

100 1000 10
2 2 8093 45 192 37 606 91 604 4 555 44 92 48 584 39 1 3 618 53 491 4 277 82 758 36 109 10 858 39 588 22 713 61 2 66 135 66 116 60 544 63 1 60 785 16 298 75 573 44 190 61 164 62 290 92 477 34 278 13 715 80 162 73 702 44 377 45 723 4 936 81 73 3 444 85 343 2 734 55 644 5 779 1 726 81 843 5...

output:

...............................##############.....##############..............############..........
................................##############....##############............#############...........
................................#############....##################.#.....################...........

result:

ok 2001 lines

Test #20:

score: 0
Accepted
time: 4415ms
memory: 177344kb

input:

490 585 10
298 -511 8292 111 271 357 430 365 504 308 411 231 322 239 531 128 504 133 364 3 320 136 21 39 524 136 388 487 167 199 60 375 65 242 256 328 56 354 227 336 61 222 480 366 169 187 571 16 559 209 34 88 75 106 423 53 389 183 329 159 36 368 112 448 442 191 46 339 132 111 462 165 161 209 509 23...

output:

......#...........................................................#.....................................................................................................................................#.....#................................#...........................................................#...

result:

ok 1171 lines

Test #21:

score: -100
Time Limit Exceeded

input:

975 875 5
835 -242 79112 655 367 178 719 639 785 677 374 356 838 780 602 26 60 866 813 724 259 98 125 161 875 345 492 774 609 586 506 801 571 410 776 146 492 724 221 289 869 654 773 568 176 798 416 444 871 347 395 571 609 627 742 784 154 449 315 97 320 183 371 832 518 844 446 524 480 797 836 485 747...

output:


result: