QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#251769#5101. Crystal CrosswindGiga_CronosWA 52ms11304kbC++231.8kb2023-11-15 06:05:042023-11-15 06:05:04

Judging History

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

  • [2023-11-15 06:05:04]
  • 评测
  • 测评结果:WA
  • 用时:52ms
  • 内存:11304kb
  • [2023-11-15 06:05:04]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
#define MAXC ((int)(1e3 + 5))

bool nm[MAXC][MAXC], ne[MAXC][MAXC], cbm[MAXC][MAXC];
int d[MAXC][MAXC];
int dx, dy;

bool is_grid(int x, int y) { return (x >= 0 && x < dx && y >= 0 && y < dy); }

int32_t main() {
	ios_base::sync_with_stdio(0), cin.tie(0);

	int k;
	cin >> dx >> dy >> k;
	vector<int> wxs(k), wys(k);
	queue<pii> q_nm;
	for (int i = 0; i < k; i++) {
		int b;
		cin >> wxs[i] >> wys[i] >> b;
		for (int j = 0; j < b; j++) {
			int x, y;
			cin >> x >> y;
			x--, y--;
			ne[x - wxs[i]][y - wys[i]] = true;
			if (!nm[x][y]) {
				nm[x][y] = 1;
				q_nm.push(pii(x, y));
			}
		}
	}

	while (!q_nm.empty()) {
		int x, y;
		tie(x, y) = q_nm.front();
		q_nm.pop();
		for (int i = 0; i < k; i++) {
			int px = x - wxs[i];
			int py = y - wys[i];
			if (is_grid(px, py) && !ne[px][py] && !nm[px][py]) {
				nm[px][py] = true;
				q_nm.push(pii(px, py));
			}
		}
	}

	for (int i = 0; i < dx; i++)
		for (int j = 0; j < dy; j++)
			d[i][j] = k;

	queue<pii> q_cbm;
	for (int i = 0; i < dx; i++)
		for (int j = 0; j < dy; j++)
			if (nm[i][j]) {
				q_cbm.push(pii(i, j));
				cbm[i][j] = true;
			}

	while (!q_cbm.empty()) {
		int x, y;
		tie(x, y) = q_cbm.front();
		q_cbm.pop();
		for (int i = 0; i < k; i++) {
			int px = x + wxs[i];
			int py = y + wys[i];
			if (!is_grid(px, py) || nm[px][py] || ne[px][py])
				continue;
			d[px][py]--;
			if (d[px][py] == 0) {
				q_cbm.push(pii(px, py));
				cbm[px][py] = true;
			}
		}
	}

	for (int i = 0; i < dy; i++, cout << "\n")
		for (int j = 0; j < dx; j++)
			cout << ".#"[nm[j][i]];
	cout << "\n";
	for (int i = 0; i < dy; i++, cout << "\n")
		for (int j = 0; j < dx; j++)
			cout << ".#"[cbm[j][i]];

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 1 1
0 1 2 1 1 3 1

output:

#.#.

#.#.

result:

ok 3 lines

Test #2:

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

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: 7608kb

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

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: 7648kb

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

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

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

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: 7944kb

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

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: 9840kb

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: 8036kb

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

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: 2ms
memory: 5852kb

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

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: 6212kb

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

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: 10268kb

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: 10ms
memory: 8296kb

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: 17ms
memory: 9940kb

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
Wrong Answer
time: 52ms
memory: 11304kb

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:

wrong answer 1st lines differ - expected: '.#.....#...................#...............................#....', found: '.#.....#...#......#..#.....##..............................#....'