QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#355624#5101. Crystal CrosswindJerryTclWA 23ms14100kbC++201.5kb2024-03-16 23:37:402024-03-16 23:37:40

Judging History

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

  • [2024-03-16 23:37:40]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:14100kb
  • [2024-03-16 23:37:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(0)->sync_with_stdio(0);
    int dx, dy, k; cin >> dx >> dy >> k; const int s = dx * dy;
    const auto &id = [&](int px, int py) { return px * dy + py; };
    const auto &valid = [&](int px, int py)
        { return 0 <= px && px < dx && 0 <= py && py < dy; };
    vector<vector<int>> g(s); vector<int> tp(s, 2), v(s, 0);
    for(int i = 1; i <= k; ++i) {
        vector<vector<int>> vis(dx, vector<int>(dy));
        int wx, wy, b; cin >> wx >> wy >> b;
        for(int j = 1, px, py; j <= b; ++j)
            cin >> px >> py, vis[px - 1][py - 1] = 1;
        for(int px = 0; px < dx; ++px)
            for(int py = 0; py < dy; ++py) {
                const int qx = px - wx, qy = py - wy;
                if(vis[px][py]) { tp[id(px, py)] = 1;
                    if(valid(qx, qy)) tp[id(qx, qy)] = 0; continue; }
                if(!valid(qx, qy)) { tp[id(px, py)] = 0; continue; }
                g[id(px, py)].push_back(id(qx, qy));
            }
    }
    const auto &dfs = [&](auto &&self, int x) -> void {
        if(v[x]) return; v[x] = 1; 
        if(tp[x] == 1) for(int y : g[x]) tp[y] = 1;
        for(int y : g[x]) self(self, y);
        if(tp[x] == 2) for(int y : g[x]) if(!tp[y]) tp[x] = 0;
    };
    for(int i = 0; i < s; ++i) dfs(dfs, i);
    for(int i = 0; i < dy; ++i, puts(""))
        for(int j = 0; j < dx; ++j) putchar(".#."[tp[id(j, i)]]);
    for(int i = 0; puts(""), i < dy; ++i)
        for(int j = 0; j < dx; ++j) putchar(".##"[tp[id(j, i)]]);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 1 1
0 1 2 1 1 3 1

output:

#.#.

#.#.

result:

ok 3 lines

Test #2:

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

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: 1ms
memory: 3608kb

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: 0ms
memory: 3652kb

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: 1ms
memory: 3860kb

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: 0ms
memory: 3656kb

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: 0ms
memory: 3604kb

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: 0ms
memory: 3652kb

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: 1ms
memory: 3644kb

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: 0ms
memory: 3664kb

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: 1ms
memory: 3708kb

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: 1ms
memory: 3844kb

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: 0ms
memory: 3620kb

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: 1ms
memory: 3792kb

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: 1ms
memory: 3828kb

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: 1ms
memory: 3828kb

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: 0ms
memory: 4156kb

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: 4ms
memory: 6772kb

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: -100
Wrong Answer
time: 23ms
memory: 14100kb

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:

wrong answer 3rd lines differ - expected: '......................................################..........', found: '......................................######........##..........'