QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#503830#3885. Jigsaw Puzzlexiaowuc1AC ✓229ms62236kbC++175.2kb2024-08-04 01:32:592024-08-04 01:33:00

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 26652kb

input:

6
0 0 1 6
0 7 4 0
0 0 2 1
5 3 0 6
3 7 0 0
4 5 2 0

output:

2 3
1 4 5
3 6 2

result:

ok correct solution

Test #2:

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

input:

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

output:

impossible

result:

ok impossible

Test #3:

score: 0
Accepted
time: 4ms
memory: 26672kb

input:

1
0 0 0 0

output:

1 1
1

result:

ok correct solution

Test #4:

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

input:

2
0 0 1 0
1 0 0 0

output:

2 1
1
2

result:

ok correct solution

Test #5:

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

input:

8
0 1 4 0
0 0 2 1
2 0 0 3
4 3 0 0
0 5 8 0
0 0 6 5
6 0 0 7
8 7 0 0

output:

impossible

result:

ok impossible

Test #6:

score: 0
Accepted
time: 4ms
memory: 27220kb

input:

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

output:

impossible

result:

ok impossible

Test #7:

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

input:

8
0 1 8 0
0 2 0 1
0 0 3 2
3 0 4 0
4 0 0 5
0 5 0 6
7 6 0 0
8 0 7 0

output:

impossible

result:

ok impossible

Test #8:

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

input:

2
0 0 0 0
0 0 0 0

output:

impossible

result:

ok impossible

Test #9:

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

input:

6
0 0 1 2
0 2 3 6
1 0 0 4
0 6 8 0
3 4 5 7
8 7 5 0

output:

impossible

result:

ok impossible

Test #10:

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

input:

8
0 8 1 0
1 2 0 0
3 0 0 2
0 0 3 4
0 4 5 0
5 6 0 0
7 0 0 6
0 0 7 8

output:

impossible

result:

ok impossible

Test #11:

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

input:

6
0 1 2 0
0 3 4 1
0 0 5 3
2 5 0 0
4 6 0 7
7 0 0 6

output:

impossible

result:

ok impossible

Test #12:

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

input:

8
0 1 3 0
0 2 4 1
0 0 5 2
3 6 8 0
4 7 9 6
5 0 0 7
8 10 0 0
9 0 0 10

output:

impossible

result:

ok impossible

Test #13:

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

input:

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

output:

impossible

result:

ok impossible

Test #14:

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

input:

6
0 0 0 1
0 2 3 0
0 0 1 2
3 5 0 4
0 5 0 0
0 0 0 4

output:

impossible

result:

ok impossible

Test #15:

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

input:

5
1 0 5 0
2 0 1 0
3 0 2 0
4 0 3 0
5 0 4 0

output:

impossible

result:

ok impossible

Test #16:

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

input:

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

output:

impossible

result:

ok impossible

Test #17:

score: 0
Accepted
time: 4ms
memory: 26980kb

input:

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

output:

impossible

result:

ok impossible

Test #18:

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

input:

12
0 8 15 14
10 2 11 0
4 5 1 13
7 2 4 15
3 0 0 11
0 9 16 0
5 10 0 16
17 0 14 13
9 0 6 1
3 7 12 0
0 12 8 0
6 0 0 17

output:

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

result:

ok correct solution

Test #19:

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

input:

44676
35342 17308 71635 76759
81917 76339 69357 8950
33973 59839 73161 4681
30921 15931 19398 68459
34760 40530 35041 35089
72144 35375 71051 26213
40155 14598 77480 75016
28040 31484 39665 17518
72021 42937 40046 32461
36148 55203 81353 35882
39775 52335 79605 8094
80921 7128 2941 13143
43070 53007...

output:

102 438
25741 23112 43164 6167 19724 2766 18486 41148 39660 23955 21258 10069 8428 21963 8370 37514 17743 42340 14502 8077 6838 27661 39754 34640 16674 36167 32369 44496 23695 21088 665 22832 3893 1694 8614 37304 8612 29257 28704 29051 17414 9722 18568 36244 34082 30645 30195 26698 33668 3980 22930 ...

result:

ok correct solution

Test #20:

score: 0
Accepted
time: 229ms
memory: 62236kb

input:

300000
135721 572637 292845 199548
404298 423541 70441 43728
171208 258887 166963 593417
166644 305152 130807 222193
447860 129470 401275 498726
536603 39402 297576 463610
243747 29902 9369 574193
229752 123336 22747 4151
439003 184557 371417 457121
170461 69978 222425 29280
192348 41328 216574 5329...

output:

500 600
132262 8426 227871 82228 290211 206827 299238 269949 201900 117330 99650 237247 64487 223928 155955 9060 62961 212433 50853 186193 166397 10777 152336 288981 156619 249428 197039 265961 49840 194565 215835 20024 132036 197055 195898 107673 284806 268113 299949 39532 96586 21794 4050 93374 89...

result:

ok correct solution

Test #21:

score: 0
Accepted
time: 161ms
memory: 52880kb

input:

299993
101347 0 118170 0
0 84325 0 127516
0 86248 0 58089
0 43555 0 238090
0 56593 0 158477
0 279883 0 96223
15079 0 251091 0
205741 0 73785 0
0 95487 0 60687
0 182748 0 2565
0 3102 0 35380
0 157319 0 252744
0 109873 0 20577
261330 0 272706 0
91480 0 224770 0
0 243318 0 204237
84188 0 217627 0
0 205...

output:

299993 1
299954
279340
258919
142126
108152
295724
266187
21835
283318
115097
295875
367
146175
201194
15866
293880
183310
207823
109914
161941
143687
21964
249572
295416
88730
189638
236426
18565
141814
146641
3912
282666
68500
127908
97581
2655
92361
117212
257602
155323
235228
297089
104788
22465...

result:

ok correct solution

Test #22:

score: 0
Accepted
time: 88ms
memory: 42372kb

input:

136647
147250 7021 75794 149142
171649 98017 123059 183741
112650 241338 54609 6047
137768 128303 5361 18510
58465 1154 85799 160516
92930 23957 78325 0
117774 152529 0 250649
163690 0 144024 44968
76604 242471 19940 201018
149298 52216 192973 19739
242179 129393 39464 33707
21964 118840 242805 8756...

output:

7 19521
61443 123368 63926 45692 134277 99228 48973 97841 73201 10854 15354 83857 32143 13304 101852 12991 67893 110785 17748 33985 52064 85939 9954 109534 7533 128928 113848 66009 39226 13901 119330 55854 29253 109112 126828 283 80107 11593 37924 23558 55532 114716 28850 108687 123575 51311 85816 2...

result:

ok correct solution

Test #23:

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

input:

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

output:

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

result:

ok correct solution

Test #24:

score: 0
Accepted
time: 222ms
memory: 61588kb

input:

297426
487601 483369 190106 324720
408383 228495 376218 462132
567149 307985 72983 327769
129709 122935 62195 487895
441863 257473 14934 286049
196587 224143 389871 70216
131955 50672 316259 344190
381476 119303 9958 280517
281125 480188 391861 97923
130036 230075 429178 378726
460945 1087 148012 59...

output:

5218 57
239222 174689 133844 290605 53135 168353 66693 148198 49430 286343 296079 229147 166872 770 43405 173757 281558 162106 255606 177269 259303 25172 78789 36436 263157 268283 236353 207772 5885 90219 259911 68161 135075 224861 118802 61843 201377 165298 68093 54717 229337 180403 67601 8586 2195...

result:

ok correct solution

Test #25:

score: 0
Accepted
time: 174ms
memory: 57352kb

input:

263256
119651 230838 387514 246914
482406 439740 79356 163585
450009 59858 468932 438450
312773 0 42881 83808
457207 81176 477165 228889
217150 334258 324355 309143
157098 89323 49800 393966
366571 430737 255210 401693
333092 57013 467527 382930
5027 370994 146871 351644
169798 180321 272111 0
17337...

output:

12 21938
71360 102076 214719 257147 47025 9714 224685 214019 90717 186232 67618 163186 197807 166358 201172 346 193449 148540 232221 75621 117401 94774 111933 72324 107377 249780 137009 65854 133767 176377 152013 13434 116952 216747 96387 188475 198837 61937 125352 47073 259315 82384 126040 74124 98...

result:

ok correct solution

Test #26:

score: 0
Accepted
time: 139ms
memory: 52612kb

input:

234879
221451 99935 356030 0
374501 373342 325870 133831
343953 17188 347047 214949
248254 0 245513 40742
165399 29760 116066 0
148078 0 223508 343260
64171 282852 0 153908
332529 175942 336132 183990
247242 279460 339554 0
333516 122756 230060 319425
166947 52771 0 349126
154931 236077 113328 38135...

output:

78293 3
77936 157123 202730
184970 39381 190016
3913 85205 130819
140164 51585 137874
49767 13523 106311
7609 133770 52772
2904 11431 188557
148023 174030 194553
66167 64154 156762
198773 92244 160451
131692 6285 77013
148342 122849 107967
174756 145564 128295
231654 225772 62793
66672 189304 137291...

result:

ok correct solution

Test #27:

score: 0
Accepted
time: 4ms
memory: 27464kb

input:

6084
11439 2942 9494 11961
0 3667 11941 9431
7494 1663 11268 502
6271 6741 8389 2149
3715 2189 1102 9742
891 1510 9728 11219
4362 10775 3079 2769
1078 9889 9305 5372
2136 9295 11006 10919
11260 4349 11624 0
8466 4293 9097 2001
6733 4021 423 0
4066 7685 3945 9473
7480 10251 2592 5642
1322 6468 5890 1...

output:

78 78
1352 4155 2592 4581 1019 5877 5190 6008 1559 2461 2616 5651 833 316 5269 880 5788 283 4070 5767 3338 2265 1085 3250 2238 26 3318 4210 3239 2404 4504 4356 4550 5674 218 5841 1480 3982 765 10 2115 661 5054 527 1180 4270 4095 3378 2935 1771 2945 3544 1867 3607 1497 2455 3663 2224 5890 1017 1604 5...

result:

ok correct solution

Test #28:

score: 0
Accepted
time: 24ms
memory: 36244kb

input:

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

output:

impossible

result:

ok impossible

Test #29:

score: 0
Accepted
time: 103ms
memory: 54640kb

input:

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

output:

impossible

result:

ok impossible

Test #30:

score: 0
Accepted
time: 96ms
memory: 53156kb

input:

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

output:

impossible

result:

ok impossible

Test #31:

score: 0
Accepted
time: 101ms
memory: 57972kb

input:

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

output:

impossible

result:

ok impossible

Test #32:

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

input:

4
8 4 5 3
1 8 7 5
4 2 3 6
7 2 1 6

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 129ms
memory: 52604kb

input:

300000
425988 555964 408521 380881
326730 229299 294925 264443
82770 416500 174276 495973
534690 331580 474292 107144
554597 345407 274661 452952
520720 374668 85917 490108
54939 62279 92627 45888
56186 125112 557711 388572
69975 105088 198043 592117
277399 282506 411991 218979
555940 293364 163425 ...

output:

impossible

result:

ok impossible

Test #34:

score: 0
Accepted
time: 120ms
memory: 50168kb

input:

296295
358766 551446 578044 131023
164837 520880 132252 15126
160612 396612 396382 349717
412602 311425 30906 297429
297679 174330 449205 472475
495146 345863 461441 17541
190301 102928 308560 193208
233526 164931 29887 371614
580402 324837 152044 267523
127708 264302 295997 303961
437118 229762 336...

output:

impossible

result:

ok impossible

Test #35:

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

input:

10
0 3 1 2
0 0 0 1
6 8 9 2
4 0 0 3
5 0 4 0
5 0 0 0
0 6 0 7
7 0 0 0
0 8 0 0
0 0 0 9

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 2ms
memory: 26988kb

input:

75
27 1 12 55
1 2 3 4
2 10 15 0
6 5 62 3
7 8 22 4
5 0 32 31
17 11 6 28
7 38 30 13
29 8 25 9
9 14 20 21
0 10 67 0
11 23 19 56
0 48 0 12
0 13 72 0
0 14 0 0
37 18 16 15
16 0 59 33
0 61 17 0
0 46 18 0
49 0 0 19
20 44 65 0
0 21 40 0
22 24 41 63
26 23 0 74
0 24 0 35
25 0 0 0
26 0 0 54
0 66 27 60
28 51 50 ...

output:

impossible

result:

ok impossible

Test #37:

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

input:

1234
1 3 4 5
7 17 2 1
2 14 15 11
6 3 8 19
9 4 138 549
12 27 10 5
44 165 1067 6
53 21 7 22
8 844 724 13
106 821 23 9
10 86 16 48
126 40 11 104
12 20 34 26
13 76 29 0
32 396 14 18
39 15 111 362
101 209 16 187
33 77 17 24
57 0 339 18
55 197 19 158
216 120 20 28
25 84 562 21
134 59 123 22
96 38 23 113
2...

output:

impossible

result:

ok impossible

Test #38:

score: 0
Accepted
time: 72ms
memory: 41164kb

input:

300000
17 14 1 2
4 1 6 3
448 5 2 28
9 3 7 11
83 4 60 30
688 5 112 774
26 37 6 8
7 65 84 10
23 8 93 103
9 12 24 74
15 10 16 20
11 194 13 465
46 19 38 12
33 160 34 13
14 175 202 476
15 18 221 889
16 109 22 219
29 44 17 32
859 686 752 18
19 27 70 21
40 20 47 403
91 816 21 45
22 201 58 25
54 1006 23 265...

output:

impossible

result:

ok impossible