QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#51339#4930. LCS of Permutationslarryzhong100 ✓106ms12396kbC++171.7kb2022-10-02 01:17:372022-10-02 01:17:40

详细

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 50ms
memory: 3728kb

input:

632
512 1 1 512 1
201 1 1 201 1
155 1 1 155 1
129 1 1 129 1
345 1 1 345 1
454 1 1 454 1
614 1 1 614 1
11 1 1 11 1
492 1 1 492 1
357 1 1 357 1
300 1 1 300 1
295 1 1 295 1
607 1 1 607 1
442 1 1 442 1
14 1 1 14 1
79 1 1 79 1
584 1 1 584 1
431 1 1 431 1
343 1 1 343 1
64 1 1 64 1
548 1 1 548 1
101 1 1 10...

output:

YES
512 511 510 509 508 507 506 505 504 503 502 501 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 ...

result:

ok Correct (632 test cases)

Test #2:

score: 0
Accepted
time: 51ms
memory: 11140kb

input:

1
200000 1 1 200000 1

output:

YES
200000 199999 199998 199997 199996 199995 199994 199993 199992 199991 199990 199989 199988 199987 199986 199985 199984 199983 199982 199981 199980 199979 199978 199977 199976 199975 199974 199973 199972 199971 199970 199969 199968 199967 199966 199965 199964 199963 199962 199961 199960 199959 19...

result:

ok Correct (1 test case)

Test #3:

score: 0
Accepted
time: 56ms
memory: 7472kb

input:

2
118278 1 1 118278 1
81722 1 1 81722 1

output:

YES
118278 118277 118276 118275 118274 118273 118272 118271 118270 118269 118268 118267 118266 118265 118264 118263 118262 118261 118260 118259 118258 118257 118256 118255 118254 118253 118252 118251 118250 118249 118248 118247 118246 118245 118244 118243 118242 118241 118240 118239 118238 118237 11...

result:

ok Correct (2 test cases)

Test #4:

score: 0
Accepted
time: 43ms
memory: 7300kb

input:

5
24223 1 1 24223 1
41513 1 1 41513 1
15442 1 1 15442 1
19470 1 1 19470 1
99352 1 1 99352 1

output:

YES
24223 24222 24221 24220 24219 24218 24217 24216 24215 24214 24213 24212 24211 24210 24209 24208 24207 24206 24205 24204 24203 24202 24201 24200 24199 24198 24197 24196 24195 24194 24193 24192 24191 24190 24189 24188 24187 24186 24185 24184 24183 24182 24181 24180 24179 24178 24177 24176 24175 24...

result:

ok Correct (5 test cases)

Test #5:

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

input:

20
11481 1 1 11481 1
53318 1 1 53318 1
13359 1 1 13359 1
8929 1 1 8929 1
15918 1 1 15918 1
509 1 1 509 1
11385 1 1 11385 1
10829 1 1 10829 1
5628 1 1 5628 1
1270 1 1 1270 1
2232 1 1 2232 1
3011 1 1 3011 1
4020 1 1 4020 1
23225 1 1 23225 1
215 1 1 215 1
1094 1 1 1094 1
10463 1 1 10463 1
708 1 1 708 1...

output:

YES
11481 11480 11479 11478 11477 11476 11475 11474 11473 11472 11471 11470 11469 11468 11467 11466 11465 11464 11463 11462 11461 11460 11459 11458 11457 11456 11455 11454 11453 11452 11451 11450 11449 11448 11447 11446 11445 11444 11443 11442 11441 11440 11439 11438 11437 11436 11435 11434 11433 11...

result:

ok Correct (20 test cases)

Test #6:

score: 0
Accepted
time: 56ms
memory: 3900kb

input:

100
1273 1 1 1273 1
1503 1 1 1503 1
2935 1 1 2935 1
4875 1 1 4875 1
2328 1 1 2328 1
2048 1 1 2048 1
4128 1 1 4128 1
2855 1 1 2855 1
6624 1 1 6624 1
2447 1 1 2447 1
2266 1 1 2266 1
1875 1 1 1875 1
2960 1 1 2960 1
2432 1 1 2432 1
8 1 1 8 1
516 1 1 516 1
127 1 1 127 1
5844 1 1 5844 1
2060 1 1 2060 1
10...

output:

YES
1273 1272 1271 1270 1269 1268 1267 1266 1265 1264 1263 1262 1261 1260 1259 1258 1257 1256 1255 1254 1253 1252 1251 1250 1249 1248 1247 1246 1245 1244 1243 1242 1241 1240 1239 1238 1237 1236 1235 1234 1233 1232 1231 1230 1229 1228 1227 1226 1225 1224 1223 1222 1221 1220 1219 1218 1217 1216 1215 1...

result:

ok Correct (100 test cases)

Test #7:

score: 0
Accepted
time: 48ms
memory: 3692kb

input:

10000
13 1 1 13 1
2 1 1 2 1
43 1 1 43 1
5 1 1 5 1
19 1 1 19 1
20 1 1 20 1
15 1 1 15 1
2 1 1 2 1
68 1 1 68 1
9 1 1 9 1
6 1 1 6 1
40 1 1 40 1
6 1 1 6 1
40 1 1 40 1
12 1 1 12 1
21 1 1 21 1
38 1 1 38 1
26 1 1 26 1
1 1 1 1 1
18 1 1 18 1
59 1 1 59 1
16 1 1 16 1
12 1 1 12 1
2 1 1 2 1
12 1 1 12 1
1 1 1 1 1
...

output:

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

result:

ok Correct (10000 test cases)

Test #8:

score: 0
Accepted
time: 69ms
memory: 3664kb

input:

50000
2 1 1 2 1
3 1 1 3 1
5 1 1 5 1
1 1 1 1 1
5 1 1 5 1
2 1 1 2 1
2 1 1 2 1
2 1 1 2 1
2 1 1 2 1
6 1 1 6 1
4 1 1 4 1
3 1 1 3 1
4 1 1 4 1
1 1 1 1 1
2 1 1 2 1
2 1 1 2 1
3 1 1 3 1
3 1 1 3 1
2 1 1 2 1
10 1 1 10 1
1 1 1 1 1
1 1 1 1 1
6 1 1 6 1
1 1 1 1 1
6 1 1 6 1
1 1 1 1 1
5 1 1 5 1
14 1 1 14 1
1 1 1 1 1
...

output:

YES
2 1 
1 2 
1 2 
YES
3 2 1 
1 2 3 
1 2 3 
YES
5 4 3 2 1 
1 2 3 4 5 
1 2 3 4 5 
YES
1 
1 
1 
YES
5 4 3 2 1 
1 2 3 4 5 
1 2 3 4 5 
YES
2 1 
1 2 
1 2 
YES
2 1 
1 2 
1 2 
YES
2 1 
1 2 
1 2 
YES
2 1 
1 2 
1 2 
YES
6 5 4 3 2 1 
1 2 3 4 5 6 
1 2 3 4 5 6 
YES
4 3 2 1 
1 2 3 4 
1 2 3 4 
YES
3 2 1 
1 2 3 
1...

result:

ok Correct (50000 test cases)

Subtask #2:

score: 8
Accepted

Test #9:

score: 8
Accepted
time: 37ms
memory: 3732kb

input:

40011
1 1 1 1 1
2 1 1 1 1
2 1 1 2 1
2 1 2 2 1
2 2 2 2 1
3 1 1 1 1
3 1 1 2 1
3 1 1 3 1
3 1 2 2 1
3 1 2 3 1
3 1 3 3 1
3 2 2 2 1
3 2 2 3 1
3 2 3 3 1
3 3 3 3 1
4 1 1 1 1
4 1 1 2 1
4 1 1 3 1
4 1 1 4 1
4 1 2 2 1
4 1 2 3 1
4 1 2 4 1
4 1 3 3 1
4 1 3 4 1
4 1 4 4 1
4 2 2 2 1
4 2 2 3 1
4 2 2 4 1
4 2 3 3 1
4 2 ...

output:

YES
1 
1 
1 
NO
YES
2 1 
1 2 
1 2 
NO
YES
1 2 
1 2 
1 2 
NO
NO
YES
3 2 1 
1 2 3 
1 2 3 
YES
3 1 2 
2 1 3 
1 2 3 
NO
NO
YES
3 1 2 
1 3 2 
1 2 3 
YES
1 3 2 
1 2 3 
1 2 3 
NO
YES
1 2 3 
1 2 3 
1 2 3 
NO
NO
NO
YES
4 3 2 1 
1 2 3 4 
1 2 3 4 
YES
3 1 4 2 
2 4 1 3 
1 2 3 4 
YES
4 3 1 2 
2 1 3 4 
1 2 3 4 
N...

result:

ok Correct (40011 test cases)

Subtask #3:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #10:

score: 10
Accepted
time: 2ms
memory: 3584kb

input:

7545
31 1 4 31 1
15 8 13 15 1
34 12 18 34 1
9 1 9 9 1
28 5 12 28 1
21 1 11 21 1
33 9 11 33 1
28 10 14 28 1
33 30 30 33 1
33 19 31 33 1
31 2 25 31 1
24 13 18 24 1
22 11 16 22 1
33 20 20 33 1
28 7 8 28 1
31 5 28 31 1
30 17 18 30 1
22 3 9 22 1
12 6 12 12 1
30 7 21 30 1
31 3 10 31 1
34 24 27 34 1
35 21 ...

output:

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

result:

ok Correct (7545 test cases)

Test #11:

score: 0
Accepted
time: 95ms
memory: 11572kb

input:

1
200000 46236 46236 200000 1

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (1 test case)

Test #12:

score: 0
Accepted
time: 44ms
memory: 10932kb

input:

1
200000 199998 199998 200000 1

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (1 test case)

Test #13:

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

input:

1
200000 73211 119733 200000 1

output:

NO

result:

ok Correct (1 test case)

Test #14:

score: 0
Accepted
time: 44ms
memory: 10824kb

input:

1
200000 200000 200000 200000 1

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (1 test case)

Test #15:

score: 0
Accepted
time: 106ms
memory: 12208kb

input:

1
200000 17422 17422 200000 1

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (1 test case)

Test #16:

score: 0
Accepted
time: 56ms
memory: 11864kb

input:

1
200000 199997 199997 200000 1

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (1 test case)

Test #17:

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

input:

1
200000 24843 82406 200000 1

output:

NO

result:

ok Correct (1 test case)

Test #18:

score: 0
Accepted
time: 54ms
memory: 11880kb

input:

1
200000 200000 200000 200000 1

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (1 test case)

Test #19:

score: 0
Accepted
time: 42ms
memory: 12088kb

input:

2
171916 1 1 171916 1
28084 1140 25963 28084 1

output:

YES
171916 171915 171914 171913 171912 171911 171910 171909 171908 171907 171906 171905 171904 171903 171902 171901 171900 171899 171898 171897 171896 171895 171894 171893 171892 171891 171890 171889 171888 171887 171886 171885 171884 171883 171882 171881 171880 171879 171878 171877 171876 171875 17...

result:

ok Correct (2 test cases)

Test #20:

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

input:

2
103116 45915 45915 103116 1
96884 64304 83444 96884 1

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (2 test cases)

Test #21:

score: 0
Accepted
time: 54ms
memory: 11396kb

input:

2
23087 20700 20700 23087 1
176913 1 1 176913 1

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (2 test cases)

Test #22:

score: 0
Accepted
time: 50ms
memory: 11416kb

input:

2
143057 1 1 143057 1
56943 56943 56943 56943 1

output:

YES
143057 143056 143055 143054 143053 143052 143051 143050 143049 143048 143047 143046 143045 143044 143043 143042 143041 143040 143039 143038 143037 143036 143035 143034 143033 143032 143031 143030 143029 143028 143027 143026 143025 143024 143023 143022 143021 143020 143019 143018 143017 143016 14...

result:

ok Correct (2 test cases)

Test #23:

score: 0
Accepted
time: 71ms
memory: 10924kb

input:

2
63028 63026 63026 63028 1
136972 80745 80745 136972 1

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (2 test cases)

Test #24:

score: 0
Accepted
time: 40ms
memory: 6952kb

input:

5
24325 12027 20928 24325 1
33551 33551 33551 33551 1
91848 1 1 91848 1
16722 2 2 16722 1
33554 17593 32887 33554 1

output:

NO
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

result:

ok Correct (5 test cases)

Test #25:

score: 0
Accepted
time: 59ms
memory: 6940kb

input:

5
86417 5681 5681 86417 1
570 3 3 570 1
32040 10134 10134 32040 1
51708 51704 51704 51708 1
29265 12195 16608 29265 1

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (5 test cases)

Test #26:

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

input:

5
2977 1 1 2977 1
3411 3411 3411 3411 1
8955 8955 8955 8955 1
110370 110370 110370 110370 1
74287 74283 74283 74287 1

output:

YES
2977 2976 2975 2974 2973 2972 2971 2970 2969 2968 2967 2966 2965 2964 2963 2962 2961 2960 2959 2958 2957 2956 2955 2954 2953 2952 2951 2950 2949 2948 2947 2946 2945 2944 2943 2942 2941 2940 2939 2938 2937 2936 2935 2934 2933 2932 2931 2930 2929 2928 2927 2926 2925 2924 2923 2922 2921 2920 2919 2...

result:

ok Correct (5 test cases)

Test #27:

score: 0
Accepted
time: 59ms
memory: 5152kb

input:

20
1300 883 883 1300 1
2409 2409 2409 2409 1
22980 22980 22980 22980 1
15455 4 4 15455 1
24568 24568 24568 24568 1
322 322 322 322 1
4398 1 1 4398 1
8257 1956 1956 8257 1
10315 1659 1659 10315 1
45979 1 1 45979 1
1262 285 285 1262 1
11356 1397 1397 11356 1
12392 7768 7768 12392 1
2809 2809 2809 2809...

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (20 test cases)

Test #28:

score: 0
Accepted
time: 44ms
memory: 4912kb

input:

20
16303 11310 11310 16303 1
4345 1 1 4345 1
5817 1657 4906 5817 1
5251 5251 5251 5251 1
28284 12365 14700 28284 1
35999 35999 35999 35999 1
10283 8857 8857 10283 1
5202 2591 2591 5202 1
6800 1 1 6800 1
5395 3076 3271 5395 1
1027 57 57 1027 1
47 47 47 47 1
11249 11247 11247 11249 1
579 441 441 579 1...

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (20 test cases)

Test #29:

score: 0
Accepted
time: 50ms
memory: 3916kb

input:

100
1273 1248 1248 1273 1
1503 1 1 1503 1
2935 1 1 2935 1
4875 4875 4875 4875 1
2328 1 1 2328 1
2048 1764 1764 2048 1
4128 4128 4128 4128 1
2855 593 593 2855 1
6624 1904 1904 6624 1
2447 2415 2415 2447 1
2266 1879 1998 2266 1
1875 1837 1837 1875 1
2960 2956 2956 2960 1
2432 1661 1661 2432 1
8 4 4 8 ...

output:

YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (100 test cases)

Test #30:

score: 0
Accepted
time: 35ms
memory: 3688kb

input:

1000
309 32 93 309 1
311 4 4 311 1
144 1 1 144 1
131 131 131 131 1
317 317 317 317 1
77 77 77 77 1
45 1 1 45 1
180 180 180 180 1
86 1 1 86 1
100 15 15 100 1
210 91 91 210 1
256 73 73 256 1
123 64 64 123 1
220 216 216 220 1
359 359 359 359 1
30 29 29 30 1
142 142 142 142 1
74 3 3 74 1
292 292 292 292...

output:

NO
YES
1 2 3 311 310 309 308 307 306 305 304 303 302 301 300 299 298 297 296 295 294 293 292 291 290 289 288 287 286 285 284 283 282 281 280 279 278 277 276 275 274 273 272 271 270 269 268 267 266 265 264 263 262 261 260 259 258 257 256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240...

result:

ok Correct (1000 test cases)

Test #31:

score: 0
Accepted
time: 44ms
memory: 3724kb

input:

10000
13 13 13 13 1
2 2 2 2 1
43 32 32 43 1
5 4 4 5 1
19 3 3 19 1
20 5 8 20 1
15 12 12 15 1
2 1 1 2 1
68 4 4 68 1
9 8 8 9 1
6 5 5 6 1
40 40 40 40 1
6 1 1 6 1
40 17 17 40 1
12 1 1 12 1
21 20 20 21 1
38 1 1 38 1
26 26 26 26 1
1 1 1 1 1
18 16 16 18 1
59 1 1 59 1
16 8 8 16 1
12 9 9 12 1
2 2 2 2 1
12 5 5...

output:

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

result:

ok Correct (10000 test cases)

Test #32:

score: 0
Accepted
time: 49ms
memory: 3664kb

input:

20000
9 9 9 9 1
5 2 2 5 1
1 1 1 1 1
3 1 1 3 1
15 1 1 15 1
16 13 13 16 1
6 3 3 6 1
1 1 1 1 1
27 1 1 27 1
24 24 24 24 1
5 5 5 5 1
3 1 1 3 1
26 26 26 26 1
2 1 1 2 1
12 1 1 12 1
3 1 1 3 1
5 1 1 5 1
9 9 9 9 1
22 3 3 22 1
15 2 2 15 1
2 1 1 2 1
8 6 6 8 1
1 1 1 1 1
5 5 5 5 1
15 4 4 15 1
15 1 1 15 1
16 5 5 1...

output:

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

result:

ok Correct (20000 test cases)

Test #33:

score: 0
Accepted
time: 80ms
memory: 3588kb

input:

100000
1 1 1 1 1
2 2 2 2 1
1 1 1 1 1
1 1 1 1 1
7 7 7 7 1
3 1 1 3 1
2 2 2 2 1
3 1 1 3 1
2 1 1 2 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
3 1 1 3 1
1 1 1 1 1
1 1 1 1 1
2 2 2 2 1
1 1 1 1 1
4 1 1 4 1
2 1 1 2 1
2 1 1 2 1
1 1 1 1 1
1 1 1 1 1
3 2 2 3 1
1 1 1 1 1
2 2 2 2 1
4 4 4 4 1
1 1 1 1 1
3 2 2 3 1
1 1 1 1 1
1 1...

output:

YES
1 
1 
1 
YES
1 2 
1 2 
1 2 
YES
1 
1 
1 
YES
1 
1 
1 
YES
1 2 3 4 5 6 7 
1 2 3 4 5 6 7 
1 2 3 4 5 6 7 
YES
3 2 1 
1 2 3 
1 2 3 
YES
1 2 
1 2 
1 2 
YES
3 2 1 
1 2 3 
1 2 3 
YES
2 1 
1 2 
1 2 
YES
1 
1 
1 
YES
1 
1 
1 
YES
1 
1 
1 
YES
3 2 1 
1 2 3 
1 2 3 
YES
1 
1 
1 
YES
1 
1 
1 
YES
1 2 
1 2 
1...

result:

ok Correct (100000 test cases)

Subtask #4:

score: 17
Accepted

Dependency #1:

100%
Accepted

Test #34:

score: 17
Accepted
time: 27ms
memory: 3660kb

input:

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

output:

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

result:

ok Correct (7545 test cases)

Test #35:

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

input:

1
200000 1 320 613 1

output:

NO

result:

ok Correct (1 test case)

Test #36:

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

input:

1
200000 1 37 328 1

output:

NO

result:

ok Correct (1 test case)

Test #37:

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

input:

1
200000 1 119733 157102 1

output:

NO

result:

ok Correct (1 test case)

Test #38:

score: 0
Accepted
time: 77ms
memory: 11920kb

input:

1
199920 1 392 510 1

output:

YES
901 900 899 898 897 896 895 894 893 892 891 890 889 888 887 886 885 884 883 882 881 880 879 878 877 876 875 874 873 872 871 870 869 868 867 866 865 864 863 862 861 860 859 858 857 856 855 854 853 852 851 850 849 848 847 846 845 844 843 842 841 840 839 838 837 836 835 834 833 832 831 830 829 828 ...

result:

ok Correct (1 test case)

Test #39:

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

input:

1
200000 1 201 860 1

output:

NO

result:

ok Correct (1 test case)

Test #40:

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

input:

1
200000 1 91 436 1

output:

NO

result:

ok Correct (1 test case)

Test #41:

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

input:

1
200000 1 82406 192973 1

output:

NO

result:

ok Correct (1 test case)

Test #42:

score: 0
Accepted
time: 64ms
memory: 12132kb

input:

1
199870 1 253 790 1

output:

YES
1042 1041 1040 1039 1038 1037 1036 1035 1034 1033 1032 1031 1030 1029 1028 1027 1026 1025 1024 1023 1022 1021 1020 1019 1018 1017 1016 1015 1014 1013 1012 1011 1010 1009 1008 1007 1006 1005 1004 1003 1002 1001 1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 9...

result:

ok Correct (1 test case)

Test #43:

score: 0
Accepted
time: 76ms
memory: 10652kb

input:

2
171916 1 177 82364 1
28044 1 123 228 1

output:

YES
82540 82539 82538 82537 82536 82535 82534 82533 82532 82531 82530 82529 82528 82527 82526 82525 82524 82523 82522 82521 82520 82519 82518 82517 82516 82515 82514 82513 82512 82511 82510 82509 82508 82507 82506 82505 82504 82503 82502 82501 82500 82499 82498 82497 82496 82495 82494 82493 82492 82...

result:

ok Correct (2 test cases)

Test #44:

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

input:

2
103116 1 240 317 1
96884 1 20 1362 1

output:

NO
NO

result:

ok Correct (2 test cases)

Test #45:

score: 0
Accepted
time: 71ms
memory: 10624kb

input:

2
23087 1 6 2290 1
176913 1 161 67795 1

output:

NO
YES
67955 67954 67953 67952 67951 67950 67949 67948 67947 67946 67945 67944 67943 67942 67941 67940 67939 67938 67937 67936 67935 67934 67933 67932 67931 67930 67929 67928 67927 67926 67925 67924 67923 67922 67921 67920 67919 67918 67917 67916 67915 67914 67913 67912 67911 67910 67909 67908 67907...

result:

ok Correct (2 test cases)

Test #46:

score: 0
Accepted
time: 80ms
memory: 11240kb

input:

2
143057 1 302 474 1
56943 1 23 28465 1

output:

YES
775 774 773 772 771 770 769 768 767 766 765 764 763 762 761 760 759 758 757 756 755 754 753 752 751 750 749 748 747 746 745 744 743 742 741 740 739 738 737 736 735 734 733 732 731 730 729 728 727 726 725 724 723 722 721 720 719 718 717 716 715 714 713 712 711 710 709 708 707 706 705 704 703 702 ...

result:

ok Correct (2 test cases)

Test #47:

score: 0
Accepted
time: 65ms
memory: 11208kb

input:

2
63028 1 16 184 1
136972 1 321 427 1

output:

NO
YES
747 746 745 744 743 742 741 740 739 738 737 736 735 734 733 732 731 730 729 728 727 726 725 724 723 722 721 720 719 718 717 716 715 714 713 712 711 710 709 708 707 706 705 704 703 702 701 700 699 698 697 696 695 694 693 692 691 690 689 688 687 686 685 684 683 682 681 680 679 678 677 676 675 6...

result:

ok Correct (2 test cases)

Test #48:

score: 0
Accepted
time: 17ms
memory: 4980kb

input:

5
24325 1 20928 21374 1
33507 1 73 459 1
91848 1 195 471 1
16722 1 14075 15313 1
33554 1 111 177 1

output:

NO
YES
531 530 529 528 527 526 525 524 523 522 521 520 519 518 517 516 515 514 513 512 511 510 509 508 507 506 505 504 503 502 501 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 4...

result:

ok Correct (5 test cases)

Test #49:

score: 0
Accepted
time: 27ms
memory: 4496kb

input:

5
86417 1 8 2042 1
570 1 1 570 1
32037 1 59 543 1
51708 1 51567 51694 1
29260 1 133 220 1

output:

NO
YES
570 569 568 567 566 565 564 563 562 561 560 559 558 557 556 555 554 553 552 551 550 549 548 547 546 545 544 543 542 541 540 539 538 537 536 535 534 533 532 531 530 529 528 527 526 525 524 523 522 521 520 519 518 517 516 515 514 513 512 511 510 509 508 507 506 505 504 503 502 501 500 499 498 4...

result:

ok Correct (5 test cases)

Test #50:

score: 0
Accepted
time: 62ms
memory: 7324kb

input:

5
2977 1 53 241 1
3400 1 17 200 1
8955 1 84 106 1
110257 1 133 829 1
74252 1 38 1954 1

output:

YES
293 292 291 290 289 288 287 286 285 284 283 282 281 280 279 278 277 276 275 274 273 272 271 270 269 268 267 266 265 264 263 262 261 260 259 258 257 256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 ...

result:

ok Correct (5 test cases)

Test #51:

score: 0
Accepted
time: 56ms
memory: 5252kb

input:

20
1300 1 1 23 1
2405 1 37 65 1
22960 1 40 574 1
15455 1 51 61 1
24568 1 11526 12902 1
322 1 12 25 1
4398 1 35 124 1
8257 1 14 28 1
10266 1 58 177 1
45942 1 93 494 1
1262 1 11 80 1
11310 1 87 130 1
12392 1 38 130 1
2809 1 6 468 1
2721 1 1282 2696 1
7236 1 27 268 1
5796 1 23 252 1
19372 1 14 16195 1
...

output:

NO
YES
101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 1 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 1...

result:

ok Correct (20 test cases)

Test #52:

score: 0
Accepted
time: 10ms
memory: 3700kb

input:

20
16303 1 37 322 1
4345 1 1949 3767 1
5808 1 11 528 1
5251 1 17 53 1
28284 1 44 404 1
35999 1 25775 29585 1
10283 1 7021 9568 1
5168 1 68 76 1
6800 1 12 344 1
5358 1 38 141 1
1027 1 12 35 1
47 1 3 15 1
11249 1 11 372 1
579 1 10 15 1
8741 1 62 6752 1
20511 1 22 711 1
8031 1 32 251 1
6585 1 2 1161 1
...

output:

NO
NO
YES
538 537 536 535 534 533 532 531 530 529 528 527 526 525 524 523 522 521 520 519 518 517 516 515 514 513 512 511 510 509 508 507 506 505 504 503 502 501 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 46...

result:

ok Correct (20 test cases)

Test #53:

score: 0
Accepted
time: 27ms
memory: 3992kb

input:

100
1273 1 31 34 1
1503 1 10 151 1
2935 1 54 652 1
4872 1 28 174 1
2328 1 8 77 1
2048 1 20 41 1
4128 1 45 1456 1
2855 1 3 1169 1
6624 1 41 77 1
2447 1 1 2447 1
2266 1 21 31 1
1875 1 25 67 1
2960 1 17 174 1
2432 1 6 1932 1
8 1 2 6 1
516 1 9 11 1
127 1 7 18 1
5831 1 17 343 1
2060 1 1 27 1
1074 1 28 23...

output:

NO
YES
160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 8...

result:

ok Correct (100 test cases)

Test #54:

score: 0
Accepted
time: 27ms
memory: 3848kb

input:

1000
309 1 93 217 1
311 1 9 34 1
144 1 10 15 1
131 1 9 9 1
308 1 11 28 1
77 1 5 15 1
42 1 6 7 1
180 1 6 8 1
86 1 40 64 1
100 1 3 3 1
210 1 105 107 1
256 1 12 15 1
123 1 4 31 1
210 1 14 15 1
359 1 11 15 1
30 1 5 7 1
140 1 4 35 1
74 1 41 67 1
292 1 15 19 1
231 1 11 21 1
222 1 3 74 1
22 1 2 21 1
157 1 ...

output:

YES
309 308 307 306 305 304 303 302 301 300 299 298 297 296 295 294 293 292 291 290 289 288 287 286 285 284 283 282 281 280 279 278 277 276 275 274 273 272 271 270 269 268 267 266 265 264 263 262 261 260 259 258 257 256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 238 237 236 ...

result:

ok Correct (1000 test cases)

Test #55:

score: 0
Accepted
time: 50ms
memory: 3596kb

input:

10000
12 1 3 4 1
2 1 1 1 1
43 1 2 11 1
5 1 3 3 1
19 1 3 4 1
20 1 6 14 1
15 1 2 6 1
2 1 2 2 1
68 1 7 10 1
9 1 1 6 1
6 1 1 4 1
40 1 2 2 1
6 1 2 2 1
40 1 3 13 1
12 1 2 5 1
21 1 2 8 1
38 1 1 38 1
26 1 1 26 1
1 1 1 1 1
18 1 1 14 1
59 1 17 56 1
16 1 1 4 1
12 1 9 9 1
2 1 1 1 1
12 1 2 6 1
1 1 1 1 1
2 1 1 1 ...

output:

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

result:

ok Correct (10000 test cases)

Test #56:

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

input:

20000
8 1 2 4 1
5 1 1 2 1
1 1 1 1 1
3 1 1 3 1
15 1 3 5 1
16 1 4 4 1
6 1 3 5 1
1 1 1 1 1
27 1 3 5 1
24 1 4 7 1
5 1 2 3 1
3 1 1 2 1
26 1 2 12 1
2 1 1 2 1
12 1 3 4 1
3 1 1 2 1
5 1 2 3 1
9 1 3 3 1
22 1 2 10 1
14 1 2 7 1
2 1 1 2 1
8 1 2 4 1
1 1 1 1 1
5 1 2 2 1
15 1 1 3 1
15 1 3 8 1
16 1 4 4 1
21 1 3 7 1
...

output:

YES
5 4 3 1 8 7 6 2 
2 6 7 8 1 3 4 5 
1 2 3 6 4 7 5 8 
NO
YES
1 
1 
1 
YES
3 2 1 
1 2 3 
1 2 3 
YES
7 6 5 4 1 11 10 9 8 2 15 14 13 12 3 
3 12 13 14 15 2 8 9 10 11 1 4 5 6 7 
1 2 3 4 8 12 5 9 13 6 10 14 7 11 15 
YES
7 6 5 1 10 9 8 2 13 12 11 3 16 15 14 4 
4 14 15 16 3 11 12 13 2 8 9 10 1 5 6 7 
1 2 3...

result:

ok Correct (20000 test cases)

Test #57:

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

input:

50000
2 1 1 2 1
3 1 1 3 1
5 1 1 2 1
1 1 1 1 1
5 1 2 2 1
2 1 1 2 1
2 1 1 2 1
2 1 1 1 1
2 1 1 1 1
6 1 1 5 1
4 1 1 4 1
3 1 1 3 1
4 1 2 2 1
1 1 1 1 1
2 1 1 2 1
2 1 1 2 1
3 1 1 3 1
3 1 1 3 1
2 1 1 2 1
10 1 1 10 1
1 1 1 1 1
1 1 1 1 1
6 1 1 1 1
1 1 1 1 1
6 1 2 4 1
1 1 1 1 1
5 1 2 2 1
14 1 2 8 1
1 1 1 1 1
6...

output:

YES
2 1 
1 2 
1 2 
YES
3 2 1 
1 2 3 
1 2 3 
NO
YES
1 
1 
1 
NO
YES
2 1 
1 2 
1 2 
YES
2 1 
1 2 
1 2 
NO
NO
NO
YES
4 3 2 1 
1 2 3 4 
1 2 3 4 
YES
3 2 1 
1 2 3 
1 2 3 
YES
3 1 4 2 
2 4 1 3 
1 2 3 4 
YES
1 
1 
1 
YES
2 1 
1 2 
1 2 
YES
2 1 
1 2 
1 2 
YES
3 2 1 
1 2 3 
1 2 3 
YES
3 2 1 
1 2 3 
1 2 3 
YE...

result:

ok Correct (50000 test cases)

Subtask #5:

score: 22
Accepted

Test #58:

score: 22
Accepted
time: 3ms
memory: 3528kb

input:

11753
20 10 12 19 0
21 3 4 18 0
21 5 12 14 0
7 1 1 3 0
16 9 10 13 0
13 3 4 9 0
21 11 13 14 0
16 15 16 16 0
20 10 10 13 0
19 3 9 13 0
18 1 17 18 0
15 2 4 4 0
14 2 4 5 0
19 3 9 16 0
16 10 12 15 0
18 2 7 17 0
18 1 1 12 0
14 1 1 1 0
9 1 2 5 0
17 8 15 15 0
18 2 2 14 0
19 9 14 17 0
20 2 10 16 0
20 8 9 17 ...

output:

NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
N...

result:

ok Correct (11753 test cases)

Test #59:

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

input:

21
6560 110 110 6560 0
904 553 553 904 0
1718 5 5 1718 0
639 2 2 639 0
23718 12352 12352 23718 0
10182 9668 9668 10182 0
4957 1334 1334 4957 0
1074 2 2 1074 0
4359 2201 2201 4359 0
7964 1 1 7964 0
16234 16234 16234 16234 0
617 1 1 617 0
1895 1494 1494 1895 0
16803 16803 16803 16803 0
3958 1 1 3958 0...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok Correct (21 test cases)

Test #60:

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

input:

1001
399 3 3 399 0
98 95 95 98 0
209 1 1 209 0
32 26 26 32 0
1 1 1 1 0
173 57 57 173 0
9 1 1 9 0
77 11 11 77 0
120 36 37 120 0
246 1 1 246 0
138 138 138 138 0
66 1 1 66 0
76 5 5 76 0
253 233 233 253 0
65 1 1 65 0
74 5 5 74 0
55 1 1 55 0
871 1 1 871 0
106 106 106 106 0
6 5 5 6 0
6 5 5 6 0
211 100 146...

output:

YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES...

result:

ok Correct (1001 test cases)

Test #61:

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

input:

21
6560 1 30 182 0
904 1 16 57 0
1718 1 11 36 0
639 1 2 295 0
23718 1 111 11309 0
10182 1 27 377 0
4957 1 22 93 0
1072 1 8 134 0
4359 1 13 140 0
7964 1 44 182 0
16234 1 31 524 0
617 1 14 45 0
1895 1 35 54 0
16803 1 59 129 0
3958 1 17 221 0
14490 1 35 414 0
4841 1 58 82 0
21837 1 17963 19658 0
26093 ...

output:

NO
YES
NO
NO
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO

result:

ok Correct (21 test cases)

Test #62:

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

input:

1001
399 1 12 33 0
98 1 6 9 0
209 1 117 184 0
32 1 3 9 0
1 1 1 1 0
173 1 12 13 0
9 1 2 3 0
75 1 3 25 0
120 1 5 23 0
246 1 5 17 0
138 1 6 22 0
66 1 4 4 0
76 1 4 24 0
253 1 6 43 0
65 1 1 23 0
74 1 3 17 0
55 1 5 55 0
871 1 109 800 0
106 1 10 10 0
6 1 1 5 0
6 1 1 5 0
207 1 9 23 0
274 1 217 219 0
34 1 5 ...

output:

NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
NO
YES
YES
NO
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
Y...

result:

ok Correct (1001 test cases)

Test #63:

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

input:

1
530 313 320 377 0

output:

YES

result:

ok Correct (1 test case)

Test #64:

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

input:

1
200000 2 2 199999 0

output:

YES

result:

ok Correct (1 test case)

Test #65:

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

input:

1
200000 39866 96910 119733 0

output:

YES

result:

ok Correct (1 test case)

Test #66:

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

input:

1
192962 36 40 134 0

output:

NO

result:

ok Correct (1 test case)

Test #67:

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

input:

1
888 201 225 833 0

output:

YES

result:

ok Correct (1 test case)

Test #68:

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

input:

1
200000 2 2 199999 0

output:

YES

result:

ok Correct (1 test case)

Test #69:

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

input:

1
200000 75873 82406 104420 0

output:

YES

result:

ok Correct (1 test case)

Test #70:

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

input:

1
84478 19 57 78 0

output:

NO

result:

ok Correct (1 test case)

Test #71:

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

input:

2
97 40 41 43 0
8427 8 9 117 0

output:

YES
NO

result:

ok Correct (2 test cases)

Test #72:

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

input:

2
2515 41 240 1573 0
300 2 161 290 0

output:

YES
NO

result:

ok Correct (2 test cases)

Test #73:

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

input:

2
187 6 123 182 0
176913 59051 73817 134152 0

output:

NO
YES

result:

ok Correct (2 test cases)

Test #74:

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

input:

2
75208 28 34 79 0
4802 8 20 30 0

output:

YES
NO

result:

ok Correct (2 test cases)

Test #75:

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

input:

2
63028 2 2 63027 0
840 11 80 163 0

output:

YES
YES

result:

ok Correct (2 test cases)

Test #76:

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

input:

5
24325 4762 15785 20928 0
22050 14 15 105 0
91848 2128 81207 87288 0
16722 20 1395 10601 0
28603 20 26 55 0

output:

NO
YES
NO
YES
NO

result:

ok Correct (5 test cases)

Test #77:

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

input:

5
714 8 121 655 0
570 1 10 235 0
32040 925 5835 8088 0
15705 4 26 151 0
23038 8 48 60 0

output:

NO
YES
YES
NO
YES

result:

ok Correct (5 test cases)

Test #78:

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

input:

5
69 1 43 67 0
3411 2 2 3410 0
715 4 6 30 0
1532 72 222 227 0
2476 30 169 244 0

output:

NO
YES
YES
YES
YES

result:

ok Correct (5 test cases)

Test #79:

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

input:

20
76 14 17 23 0
1795 5 12 30 0
302 1 17 18 0
572 27 123 343 0
350 37 70 126 0
172 1 5 34 0
1223 5 5 49 0
317 26 42 236 0
10315 2064 5090 6560 0
134 11 31 118 0
43 29 31 33 0
87 10 13 51 0
1549 8 17 1284 0
291 2 11 13 0
100 23 27 32 0
3834 3 6 213 0
830 7 24 427 0
29 17 24 27 0
29 18 21 22 0
105 1 5...

output:

YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
NO

result:

ok Correct (20 test cases)

Test #80:

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

input:

20
161 4 37 101 0
869 5 42 115 0
109 17 49 53 0
37 4 35 35 0
28284 7178 17469 17850 0
19084 10 18 106 0
1622 5 18 18 0
3269 2 15 109 0
6800 2 2 6799 0
1348 4 30 1327 0
42 21 24 26 0
27 3 3 3 0
2588 7 9 41 0
214 2 6 18 0
5950 7 25 34 0
11757 14 28 30 0
8031 2 2 8030 0
514 2 15 17 0
159 1 10 16 0
82 9...

output:

YES
YES
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES

result:

ok Correct (20 test cases)

Test #81:

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

input:

100
55 13 23 34 0
110 1 9 12 0
1467 2 32 1114 0
87 47 56 56 0
1260 7 10 18 0
1326 7 10 19 0
67 20 26 61 0
317 9 35 67 0
6624 2 2 6623 0
38 4 13 16 0
56 23 39 40 0
1875 2 2 1874 0
117 1 10 12 0
21 2 7 16 0
8 1 1 8 0
154 1 7 22 0
127 2 2 126 0
4840 8 11 55 0
2060 1420 1891 1917 0
358 3 27 64 0
406 5 9...

output:

YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
NO
YES
NO
YES
NO
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
YES
YES...

result:

ok Correct (100 test cases)

Test #82:

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

input:

1000
309 6 93 194 0
255 4 7 9 0
144 2 2 143 0
114 2 5 11 0
8 4 6 6 0
77 8 24 44 0
45 1 3 15 0
180 2 2 179 0
14 1 4 6 0
100 2 2 99 0
93 1 2 44 0
176 1 8 22 0
123 31 56 108 0
135 1 5 26 0
8 3 6 7 0
27 3 3 3 0
126 1 3 42 0
14 5 5 10 0
14 2 10 13 0
210 1 7 30 0
224 6 32 214 0
3 2 2 3 0
121 2 3 20 0
63 3...

output:

YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES...

result:

ok Correct (1000 test cases)

Test #83:

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

input:

10000
7 1 1 2 0
2 1 1 2 0
14 1 3 11 0
2 1 2 2 0
9 2 2 8 0
7 1 1 2 0
7 1 2 6 0
2 1 1 2 0
34 1 2 27 0
4 2 2 3 0
6 1 1 3 0
22 3 3 3 0
6 1 1 3 0
8 3 5 6 0
6 1 2 2 0
15 1 2 7 0
38 15 21 26 0
13 2 3 7 0
1 1 1 1 0
9 1 3 3 0
59 1 2 47 0
16 1 2 10 0
12 2 2 11 0
2 1 1 2 0
4 2 3 3 0
1 1 1 1 0
1 1 1 1 0
14 2 2 ...

output:

NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
NO
YES
YES
NO
YES
YES
NO
YES
Y...

result:

ok Correct (10000 test cases)

Test #84:

score: 0
Accepted
time: 7ms
memory: 3516kb

input:

20000
9 1 2 3 0
5 1 1 5 0
1 1 1 1 0
3 2 3 3 0
15 1 1 15 0
8 1 2 5 0
5 1 2 2 0
1 1 1 1 0
9 1 2 4 0
20 2 3 3 0
3 1 1 3 0
2 1 1 2 0
8 3 5 8 0
2 1 1 2 0
6 1 1 2 0
1 1 1 1 0
5 1 2 5 0
9 1 3 4 0
22 1 4 19 0
12 1 2 7 0
2 1 1 2 0
2 1 1 2 0
1 1 1 1 0
5 1 1 3 0
15 3 10 14 0
5 1 1 2 0
11 1 2 5 0
21 1 2 18 0
2 ...

output:

NO
YES
YES
NO
YES
YES
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
Y...

result:

ok Correct (20000 test cases)

Test #85:

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

input:

50000
2 1 1 2 0
3 1 1 3 0
5 1 1 1 0
1 1 1 1 0
5 1 2 4 0
2 1 1 2 0
1 1 1 1 0
2 1 1 2 0
2 1 1 2 0
6 2 2 5 0
4 1 1 2 0
3 1 1 3 0
2 1 2 2 0
1 1 1 1 0
2 1 1 2 0
1 1 1 1 0
3 1 1 3 0
3 1 2 2 0
1 1 1 1 0
10 1 3 6 0
1 1 1 1 0
1 1 1 1 0
3 2 2 3 0
1 1 1 1 0
6 2 2 5 0
1 1 1 1 0
4 1 1 1 0
6 2 2 2 0
1 1 1 1 0
5 1...

output:

YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YE...

result:

ok Correct (50000 test cases)

Subtask #6:

score: 40
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #86:

score: 40
Accepted
time: 32ms
memory: 3576kb

input:

11753
20 10 12 19 1
21 3 4 18 1
21 5 12 14 1
7 1 1 3 1
16 9 10 13 1
13 3 4 9 1
21 11 13 14 1
16 15 16 16 1
20 10 10 13 1
19 3 9 13 1
18 1 17 18 1
15 2 4 4 1
14 2 4 5 1
19 3 9 16 1
16 10 12 15 1
18 2 7 17 1
18 1 1 12 1
14 1 1 1 1
9 1 2 5 1
17 8 15 15 1
18 2 2 14 1
19 9 14 17 1
20 2 10 16 1
20 8 9 17 ...

output:

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

result:

ok Correct (11753 test cases)

Test #87:

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

input:

1
530 313 320 377 1

output:

YES
530 529 528 527 526 525 524 523 522 521 520 519 518 517 516 515 514 513 512 511 510 509 508 507 506 505 504 503 502 501 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 ...

result:

ok Correct (1 test case)

Test #88:

score: 0
Accepted
time: 70ms
memory: 10968kb

input:

1
200000 2 2 199999 1

output:

YES
200000 1 199999 199998 199997 199996 199995 199994 199993 199992 199991 199990 199989 199988 199987 199986 199985 199984 199983 199982 199981 199980 199979 199978 199977 199976 199975 199974 199973 199972 199971 199970 199969 199968 199967 199966 199965 199964 199963 199962 199961 199960 199959 ...

result:

ok Correct (1 test case)

Test #89:

score: 0
Accepted
time: 82ms
memory: 11120kb

input:

1
200000 39866 96910 119733 1

output:

YES
200000 199999 199998 199997 199996 199995 199994 199993 199992 199991 199990 199989 199988 199987 199986 199985 199984 199983 199982 199981 199980 199979 199978 199977 199976 199975 199974 199973 199972 199971 199970 199969 199968 199967 199966 199965 199964 199963 199962 199961 199960 199959 19...

result:

ok Correct (1 test case)

Test #90:

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

input:

1
192962 36 40 134 1

output:

NO

result:

ok Correct (1 test case)

Test #91:

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

input:

1
888 201 225 833 1

output:

YES
888 887 886 885 884 883 882 881 880 879 878 877 876 875 874 873 872 871 870 869 868 867 866 865 864 863 862 861 860 859 858 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 6...

result:

ok Correct (1 test case)

Test #92:

score: 0
Accepted
time: 89ms
memory: 12396kb

input:

1
200000 2 2 199999 1

output:

YES
200000 1 199999 199998 199997 199996 199995 199994 199993 199992 199991 199990 199989 199988 199987 199986 199985 199984 199983 199982 199981 199980 199979 199978 199977 199976 199975 199974 199973 199972 199971 199970 199969 199968 199967 199966 199965 199964 199963 199962 199961 199960 199959 ...

result:

ok Correct (1 test case)

Test #93:

score: 0
Accepted
time: 99ms
memory: 11384kb

input:

1
200000 75873 82406 104420 1

output:

YES
200000 199999 199998 199997 199996 199995 199994 199993 199992 199991 199990 199989 199988 199987 199986 199985 199984 199983 199982 199981 199980 199979 199978 199977 199976 199975 199974 199973 199972 199971 199970 199969 199968 199967 199966 199965 199964 199963 199962 199961 199960 199959 19...

result:

ok Correct (1 test case)

Test #94:

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

input:

1
84478 19 57 78 1

output:

NO

result:

ok Correct (1 test case)

Test #95:

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

input:

2
97 40 41 43 1
8427 8 9 117 1

output:

YES
86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 1 97 96 95 94 93 92 91 90 89 88 2 87 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 44 43 42 40 41 
87 88 89 90 9...

result:

ok Correct (2 test cases)

Test #96:

score: 0
Accepted
time: 3ms
memory: 3812kb

input:

2
2515 41 240 1573 1
300 2 161 290 1

output:

YES
2515 2514 2513 2512 2511 2510 2509 2508 2507 2506 2505 2504 2503 2502 2501 2500 2499 2498 2497 2496 2495 2494 2493 2492 2491 2490 2489 2488 2487 2486 2485 2484 2483 2482 2481 2480 2479 2478 2477 2476 2475 2474 2473 2472 2471 2470 2469 2468 2467 2466 2465 2464 2463 2462 2461 2460 2459 2458 2457 2...

result:

ok Correct (2 test cases)

Test #97:

score: 0
Accepted
time: 56ms
memory: 11168kb

input:

2
187 6 123 182 1
176913 59051 73817 134152 1

output:

NO
YES
176913 176912 176911 176910 176909 176908 176907 176906 176905 176904 176903 176902 176901 176900 176899 176898 176897 176896 176895 176894 176893 176892 176891 176890 176889 176888 176887 176886 176885 176884 176883 176882 176881 176880 176879 176878 176877 176876 176875 176874 176873 176872...

result:

ok Correct (2 test cases)

Test #98:

score: 0
Accepted
time: 43ms
memory: 6536kb

input:

2
75208 28 34 79 1
4802 8 20 30 1

output:

YES
163 2849 5534 8219 10904 13589 16274 18959 21644 24329 27014 29699 32384 35069 37754 40439 43124 45809 48494 51179 53864 56549 59234 61919 64604 67289 69974 72659 162 2848 5533 8218 10903 13588 16273 18958 21643 24328 27013 29698 32383 35068 37753 40438 43123 45808 48493 51178 53863 56548 59233 ...

result:

ok Correct (2 test cases)

Test #99:

score: 0
Accepted
time: 19ms
memory: 5500kb

input:

2
63028 2 2 63027 1
840 11 80 163 1

output:

YES
63028 1 63027 63026 63025 63024 63023 63022 63021 63020 63019 63018 63017 63016 63015 63014 63013 63012 63011 63010 63009 63008 63007 63006 63005 63004 63003 63002 63001 63000 62999 62998 62997 62996 62995 62994 62993 62992 62991 62990 62989 62988 62987 62986 62985 62984 62983 62982 62981 62980 ...

result:

ok Correct (2 test cases)

Test #100:

score: 0
Accepted
time: 23ms
memory: 4184kb

input:

5
24325 4762 15785 20928 1
22050 14 15 105 1
91848 2128 81207 87288 1
16722 20 1395 10601 1
28603 20 26 55 1

output:

NO
YES
210 1785 3359 4933 6507 8081 9655 11229 12803 14377 15951 17525 19099 20673 209 1784 3358 4932 6506 8080 9654 11228 12802 14376 15950 17524 19098 20672 208 1783 3357 4931 6505 8079 9653 11227 12801 14375 15949 17523 19097 20671 207 1782 3356 4930 6504 8078 9652 11226 12800 14374 15948 17522 1...

result:

ok Correct (5 test cases)

Test #101:

score: 0
Accepted
time: 21ms
memory: 4540kb

input:

5
714 8 121 655 1
570 1 10 235 1
32040 925 5835 8088 1
15705 4 26 151 1
23038 8 48 60 1

output:

NO
YES
244 243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 1...

result:

ok Correct (5 test cases)

Test #102:

score: 0
Accepted
time: 3ms
memory: 3860kb

input:

5
69 1 43 67 1
3411 2 2 3410 1
715 4 6 30 1
1532 72 222 227 1
2476 30 169 244 1

output:

NO
YES
3411 1 3410 3409 3408 3407 3406 3405 3404 3403 3402 3401 3400 3399 3398 3397 3396 3395 3394 3393 3392 3391 3390 3389 3388 3387 3386 3385 3384 3383 3382 3381 3380 3379 3378 3377 3376 3375 3374 3373 3372 3371 3370 3369 3368 3367 3366 3365 3364 3363 3362 3361 3360 3359 3358 3357 3356 3355 3354 3...

result:

ok Correct (5 test cases)

Test #103:

score: 0
Accepted
time: 3ms
memory: 3880kb

input:

20
76 14 17 23 1
1795 5 12 30 1
302 1 17 18 1
572 27 123 343 1
350 37 70 126 1
172 1 5 34 1
1223 5 5 49 1
317 26 42 236 1
10315 2064 5090 6560 1
134 11 31 118 1
43 29 31 33 1
87 10 13 51 1
1549 8 17 1284 1
291 2 11 13 1
100 23 27 32 1
3834 3 6 213 1
830 7 24 427 1
29 17 24 27 1
29 18 21 22 1
105 1 5...

output:

YES
48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 1 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 2 49 76 75 74 3 73 72 4 5 6 7 8 9 10 11 12 13 26 25 24 23 22 21 20 19 18 14 15 16 17 
72 73 74 75 76 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 6...

result:

ok Correct (20 test cases)

Test #104:

score: 0
Accepted
time: 25ms
memory: 4264kb

input:

20
161 4 37 101 1
869 5 42 115 1
109 17 49 53 1
37 4 35 35 1
28284 7178 17469 17850 1
19084 10 18 106 1
1622 5 18 18 1
3269 2 15 109 1
6800 2 2 6799 1
1348 4 30 1327 1
42 21 24 26 1
27 3 3 3 1
2588 7 9 41 1
214 2 6 18 1
5950 7 25 34 1
11757 14 28 30 1
8031 2 2 8030 1
514 2 15 17 1
159 1 10 16 1
82 9...

output:

YES
161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 1 2 3 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 ...

result:

ok Correct (20 test cases)

Test #105:

score: 0
Accepted
time: 26ms
memory: 3844kb

input:

100
55 13 23 34 1
110 1 9 12 1
1467 2 32 1114 1
87 47 56 56 1
1260 7 10 18 1
1326 7 10 19 1
67 20 26 61 1
317 9 35 67 1
6624 2 2 6623 1
38 4 13 16 1
56 23 39 40 1
1875 2 2 1874 1
117 1 10 12 1
21 2 7 16 1
8 1 1 8 1
154 1 7 22 1
127 2 2 126 1
4840 8 11 55 1
2060 1420 1891 1917 1
358 3 27 64 1
406 5 9...

output:

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

result:

ok Correct (100 test cases)

Test #106:

score: 0
Accepted
time: 25ms
memory: 3688kb

input:

1000
309 6 93 194 1
255 4 7 9 1
144 2 2 143 1
114 2 5 11 1
8 4 6 6 1
77 8 24 44 1
45 1 3 15 1
180 2 2 179 1
14 1 4 6 1
100 2 2 99 1
93 1 2 44 1
176 1 8 22 1
123 31 56 108 1
135 1 5 26 1
8 3 6 7 1
27 3 3 3 1
126 1 3 42 1
14 5 5 10 1
14 2 10 13 1
210 1 7 30 1
224 6 32 214 1
3 2 2 3 1
121 2 3 20 1
63 3...

output:

YES
309 308 307 306 305 304 303 302 301 300 299 298 297 296 295 294 293 292 291 290 289 288 287 286 285 284 283 282 1 2 3 4 5 281 280 279 278 277 276 275 274 273 272 271 270 269 268 267 266 265 264 263 262 261 260 259 258 257 256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 23...

result:

ok Correct (1000 test cases)

Test #107:

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

input:

10000
7 1 1 2 1
2 1 1 2 1
14 1 3 11 1
2 1 2 2 1
9 2 2 8 1
7 1 1 2 1
7 1 2 6 1
2 1 1 2 1
34 1 2 27 1
4 2 2 3 1
6 1 1 3 1
22 3 3 3 1
6 1 1 3 1
8 3 5 6 1
6 1 2 2 1
15 1 2 7 1
38 15 21 26 1
13 2 3 7 1
1 1 1 1 1
9 1 3 3 1
59 1 2 47 1
16 1 2 10 1
12 2 2 11 1
2 1 1 2 1
4 2 3 3 1
1 1 1 1 1
1 1 1 1 1
14 2 2 ...

output:

NO
YES
2 1 
1 2 
1 2 
YES
13 12 11 10 9 8 7 6 5 4 1 14 2 3 
3 2 14 1 4 5 6 7 8 9 10 11 12 13 
1 2 3 4 14 5 6 7 8 9 10 11 12 13 
NO
YES
9 1 8 7 6 5 4 3 2 
1 9 2 3 4 5 6 7 8 
1 2 9 3 4 5 6 7 8 
NO
YES
7 6 5 4 3 1 2 
2 1 3 4 5 6 7 
1 2 3 4 5 6 7 
YES
2 1 
1 2 
1 2 
YES
28 27 26 25 24 23 22 21 20 19 18 ...

result:

ok Correct (10000 test cases)

Test #108:

score: 0
Accepted
time: 31ms
memory: 3668kb

input:

20000
9 1 2 3 1
5 1 1 5 1
1 1 1 1 1
3 2 3 3 1
15 1 1 15 1
8 1 2 5 1
5 1 2 2 1
1 1 1 1 1
9 1 2 4 1
20 2 3 3 1
3 1 1 3 1
2 1 1 2 1
8 3 5 8 1
2 1 1 2 1
6 1 1 2 1
1 1 1 1 1
5 1 2 5 1
9 1 3 4 1
22 1 4 19 1
12 1 2 7 1
2 1 1 2 1
2 1 1 2 1
1 1 1 1 1
5 1 1 3 1
15 3 10 14 1
5 1 1 2 1
11 1 2 5 1
21 1 2 18 1
2 ...

output:

NO
YES
5 4 3 2 1 
1 2 3 4 5 
1 2 3 4 5 
YES
1 
1 
1 
NO
YES
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
YES
6 5 4 3 1 8 7 2 
2 7 8 1 3 4 5 6 
1 2 3 7 4 8 5 6 
NO
YES
1 
1 
1 
NO
NO
YES
3 2 1 
1 2 3 
1 2 3 
YES
2 1 
1 2 
1 2 
NO
YES
2...

result:

ok Correct (20000 test cases)

Test #109:

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

input:

50000
2 1 1 2 1
3 1 1 3 1
5 1 1 1 1
1 1 1 1 1
5 1 2 4 1
2 1 1 2 1
1 1 1 1 1
2 1 1 2 1
2 1 1 2 1
6 2 2 5 1
4 1 1 2 1
3 1 1 3 1
2 1 2 2 1
1 1 1 1 1
2 1 1 2 1
1 1 1 1 1
3 1 1 3 1
3 1 2 2 1
1 1 1 1 1
10 1 3 6 1
1 1 1 1 1
1 1 1 1 1
3 2 2 3 1
1 1 1 1 1
6 2 2 5 1
1 1 1 1 1
4 1 1 1 1
6 2 2 2 1
1 1 1 1 1
5 1...

output:

YES
2 1 
1 2 
1 2 
YES
3 2 1 
1 2 3 
1 2 3 
NO
YES
1 
1 
1 
YES
5 4 3 1 2 
2 1 3 4 5 
1 2 3 4 5 
YES
2 1 
1 2 
1 2 
YES
1 
1 
1 
YES
2 1 
1 2 
1 2 
YES
2 1 
1 2 
1 2 
YES
6 1 5 4 3 2 
1 6 2 3 4 5 
1 2 6 3 4 5 
NO
YES
3 2 1 
1 2 3 
1 2 3 
NO
YES
1 
1 
1 
YES
2 1 
1 2 
1 2 
YES
1 
1 
1 
YES
3 2 1 
1 2...

result:

ok Correct (50000 test cases)