QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#217665 | #5101. Crystal Crosswind | ucup-team1004# | AC ✓ | 177ms | 56472kb | C++14 | 2.0kb | 2023-10-17 08:49:46 | 2023-10-17 08:49:46 |
Judging History
answer
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;using LL=__uint128_t;
const int N=1e3+5,M=N*8+5,K=600+5,mod=998244353,Mod=mod-1;const db eps=1e-6;const int INF=1e9+7;mt19937 rnd(263082);
int dx,dy,k,wx[N],wy[N];
int v[N][N],vs[11][N][N];
int CK(int x,int y){return x>=1&&x<=dx&&y>=1&&y<=dy;}
void Solve(){
int i,j,h;scanf("%d%d%d",&dy,&dx,&k);
for(i=1;i<=k;i++){
scanf("%d%d",&wy[i],&wx[i]);wy[i]=-wy[i];wx[i]=-wx[i];
int x;scanf("%d",&x);
while(x--) {int y,z;scanf("%d%d",&z,&y);v[y][z]=1;vs[i][y][z]=1;if(CK(y+wx[i],z+wy[i])) v[y+wx[i]][z+wy[i]]=-1;}
}
for(i=1;i<=dx;i++){
for(j=1;j<=dy;j++) for(h=1;h<=k;h++) if(!CK(i+wx[h],j+wy[h])&&!vs[h][i][j]) v[i][j]=-1/*,cerr<<i<<' '<<j<<' '<<h<<'\n'*/;
}
/*for(i=1;i<=dx;i++) {
for(j=1;j<=dy;j++) printf("%c",v[i][j]==1?'#':'.');printf("\n");
}
printf("\n");*/
queue<pii> q;for(i=1;i<=dx;i++) for(j=1;j<=dy;j++) if(v[i][j]) q.emplace(i,j);
while(!q.empty()){
auto p=q.front();q.pop();//cerr<<p.fi<<' '<<p.se<<'\n';
if(v[p.fi][p.se]==1){
for(j=1;j<=k;j++) {
int x=p.fi+wx[j],y=p.se+wy[j];
if(vs[j][p.fi][p.se]||!CK(x,y)||v[x][y]) continue;
v[x][y]=1;q.emplace(x,y);//cerr<<x<<' '<<y<<'\n';
}
}else{
for(j=1;j<=k;j++) {
int x=p.fi-wx[j],y=p.se-wy[j];
if(!CK(x,y)||vs[j][x][y]||v[x][y]) continue;
v[x][y]=-1;q.emplace(x,y);
}
}
}
for(i=1;i<=dx;i++) {
for(j=1;j<=dy;j++) printf("%c",v[i][j]==1?'#':'.');printf("\n");
}
printf("\n");
for(i=1;i<=dx;i++) {
for(j=1;j<=dy;j++) printf("%c",v[i][j]==-1?'.':'#');printf("\n");
}
}
int main(){
int t=1;
// scanf("%d",&t);
while(t--) Solve();
cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 8092kb
input:
4 1 1 0 1 2 1 1 3 1
output:
#.#. #.#.
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 10268kb
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: 8088kb
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: 10116kb
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: 0ms
memory: 8252kb
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: 10160kb
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: 12224kb
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: 12208kb
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: 8064kb
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: 8228kb
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: 10096kb
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: 10144kb
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: 12184kb
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: 0ms
memory: 26636kb
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: 10104kb
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: 2ms
memory: 12108kb
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: 2ms
memory: 8116kb
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: 7ms
memory: 10800kb
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: 20ms
memory: 47552kb
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: 30ms
memory: 50528kb
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: 0
Accepted
time: 89ms
memory: 36068kb
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:
ok 1751 lines
Test #22:
score: 0
Accepted
time: 52ms
memory: 24888kb
input:
790 945 2 -172 642 9437 404 241 584 715 739 562 515 857 480 933 20 539 660 286 435 306 370 129 552 571 762 745 452 569 436 875 156 563 784 922 7 311 479 791 352 788 693 271 767 828 504 512 504 509 234 423 392 209 365 746 463 458 715 830 777 70 253 631 686 701 724 546 245 6 707 547 714 752 170 177 28...
output:
................................#....#............................................................................................................................................................................................................................#............................................
result:
ok 1891 lines
Test #23:
score: 0
Accepted
time: 177ms
memory: 56276kb
input:
1000 1000 10 -847 119 84054 155 852 456 38 217 810 730 272 752 810 390 76 530 714 770 438 595 635 879 286 687 167 89 967 998 56 848 579 221 231 305 345 652 537 543 886 23 824 840 994 669 139 310 321 871 684 723 429 341 715 78 119 48 799 488 42 926 166 886 669 50 357 99 616 755 954 731 961 45 640 936...
output:
..........#..............................#....................##.................##....#....#.........#....#...#..........#......................#....................................#.......#...#..#...........................#......................................................#................#.#...
result:
ok 2001 lines
Test #24:
score: 0
Accepted
time: 177ms
memory: 55076kb
input:
1000 1000 10 552 -919 90965 708 27 270 277 441 122 461 82 15 257 863 420 975 829 286 521 540 921 525 281 44 32 174 230 615 25 524 690 285 499 5 869 510 937 446 857 601 908 985 986 625 596 584 481 627 942 907 887 604 700 810 906 247 418 298 948 314 416 680 109 273 678 483 911 384 850 594 424 823 953 ...
output:
.#..........#...........................#....................#...#..........................#......#.....................#.........................#.........................................#..........#..#.#....#...................#...........#...............................#............................
result:
ok 2001 lines
Test #25:
score: 0
Accepted
time: 172ms
memory: 56472kb
input:
1000 1000 10 910 750 80037 48 665 186 284 302 683 515 204 778 948 398 420 665 594 497 577 369 63 937 606 95 78 400 668 409 959 269 705 774 515 56 615 671 618 816 696 491 97 951 317 129 726 670 870 732 811 18 491 219 759 5 667 381 148 293 252 945 644 903 797 83 561 510 753 145 554 798 869 953 811 304...
output:
......#...................................#.......##..#..#..#.........................#..................#.........................#...#.#.......#..........#....###.#.....#...........#..#..#..........#...#.....#....#...#.......#............#.#......#..#.....#......#.....................##..............
result:
ok 2001 lines
Test #26:
score: 0
Accepted
time: 13ms
memory: 6064kb
input:
987 273 1 5 13 0
output:
...............................................................................................................................................................................................................................................................................................................
result:
ok 547 lines
Test #27:
score: 0
Accepted
time: 0ms
memory: 8124kb
input:
5 5 1 2 2 1 2 2
output:
..... .#... ..... ..... ..... ..... .#... ..... ...#. .....
result:
ok 11 lines
Extra Test:
score: 0
Extra Test Passed