QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#516914#4930. LCS of Permutationsegypt_ioi2024_03#100 ✓96ms90624kbC++202.0kb2024-08-12 23:58:362024-08-12 23:58:37

詳細信息

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 51ms
memory: 4084kb

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
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 (632 test cases)

Test #2:

score: 3
Accepted
time: 96ms
memory: 28104kb

input:

1
200000 1 1 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 #3:

score: 3
Accepted
time: 90ms
memory: 16696kb

input:

2
118278 1 1 118278 1
81722 1 1 81722 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 #4:

score: 3
Accepted
time: 82ms
memory: 14868kb

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
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 #5:

score: 3
Accepted
time: 69ms
memory: 9416kb

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
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 #6:

score: 3
Accepted
time: 55ms
memory: 4932kb

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
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 #7:

score: 3
Accepted
time: 35ms
memory: 3748kb

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
1 2 3 4 5 6 7 8 9 10 11 12 13 
13 12 11 10 9 8 7 6 5 4 3 2 1 
13 12 11 10 9 8 7 6 5 4 3 2 1 
YES
1 2 
2 1 
2 1 
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 
43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24...

result:

ok Correct (10000 test cases)

Test #8:

score: 3
Accepted
time: 52ms
memory: 3524kb

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
1 2 
2 1 
2 1 
YES
1 2 3 
3 2 1 
3 2 1 
YES
1 2 3 4 5 
5 4 3 2 1 
5 4 3 2 1 
YES
1 
1 
1 
YES
1 2 3 4 5 
5 4 3 2 1 
5 4 3 2 1 
YES
1 2 
2 1 
2 1 
YES
1 2 
2 1 
2 1 
YES
1 2 
2 1 
2 1 
YES
1 2 
2 1 
2 1 
YES
1 2 3 4 5 6 
6 5 4 3 2 1 
6 5 4 3 2 1 
YES
1 2 3 4 
4 3 2 1 
4 3 2 1 
YES
1 2 3 
3 2 1 
3...

result:

ok Correct (50000 test cases)

Subtask #2:

score: 8
Accepted

Test #9:

score: 8
Accepted
time: 32ms
memory: 3628kb

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
1 2 
2 1 
2 1 
NO
YES
1 2 
1 2 
1 2 
NO
NO
YES
1 2 3 
3 2 1 
3 2 1 
YES
1 2 3 
3 2 1 
2 1 3 
NO
NO
YES
1 2 3 
3 1 2 
1 3 2 
YES
1 2 3 
2 1 3 
2 1 3 
NO
YES
1 2 3 
1 2 3 
1 2 3 
NO
NO
NO
YES
1 2 3 4 
4 3 2 1 
4 3 2 1 
YES
1 2 3 4 
4 3 2 1 
2 1 4 3 
YES
1 2 3 4 
4 3 2 1 
3 2 1 4 
N...

result:

ok Correct (40011 test cases)

Subtask #3:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #10:

score: 10
Accepted
time: 4ms
memory: 3684kb

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 30 31 32 33 
4 3 2 1 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 
4 3 2 1 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: 10
Accepted
time: 79ms
memory: 39836kb

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: 10
Accepted
time: 39ms
memory: 90624kb

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: 10
Accepted
time: 0ms
memory: 3492kb

input:

1
200000 73211 119733 200000 1

output:

NO

result:

ok Correct (1 test case)

Test #14:

score: 10
Accepted
time: 42ms
memory: 87792kb

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: 10
Accepted
time: 92ms
memory: 31600kb

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: 10
Accepted
time: 30ms
memory: 87784kb

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: 10
Accepted
time: 0ms
memory: 3556kb

input:

1
200000 24843 82406 200000 1

output:

NO

result:

ok Correct (1 test case)

Test #18:

score: 10
Accepted
time: 36ms
memory: 87784kb

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: 10
Accepted
time: 82ms
memory: 23704kb

input:

2
171916 1 1 171916 1
28084 1140 25963 28084 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 #20:

score: 10
Accepted
time: 30ms
memory: 27772kb

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: 10
Accepted
time: 96ms
memory: 32324kb

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: 10
Accepted
time: 76ms
memory: 34932kb

input:

2
143057 1 1 143057 1
56943 56943 56943 56943 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 #23:

score: 10
Accepted
time: 47ms
memory: 42348kb

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: 10
Accepted
time: 52ms
memory: 27232kb

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: 10
Accepted
time: 57ms
memory: 29412kb

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: 10
Accepted
time: 30ms
memory: 50432kb

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
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 #27:

score: 10
Accepted
time: 50ms
memory: 18124kb

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: 10
Accepted
time: 31ms
memory: 19500kb

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: 10
Accepted
time: 39ms
memory: 9864kb

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: 10
Accepted
time: 37ms
memory: 4464kb

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 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 (1000 test cases)

Test #31:

score: 10
Accepted
time: 36ms
memory: 3812kb

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 32 33 34 35 36 37 38 39 40 41 42 43 
12 11 10 9 8 7 6 5 4 3 2 1 13 14 15 16 17 18 19 20 21 22 23...

result:

ok Correct (10000 test cases)

Test #32:

score: 10
Accepted
time: 40ms
memory: 3656kb

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 2 3 4 5 
4 3 2 1 5 
4 3 2 1 5 
YES
1 
1 
1 
YES
1 2 3 
3 2 1 
3 2 1 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 
4 3 2...

result:

ok Correct (20000 test cases)

Test #33:

score: 10
Accepted
time: 72ms
memory: 3552kb

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
1 2 3 
3 2 1 
3 2 1 
YES
1 2 
1 2 
1 2 
YES
1 2 3 
3 2 1 
3 2 1 
YES
1 2 
2 1 
2 1 
YES
1 
1 
1 
YES
1 
1 
1 
YES
1 
1 
1 
YES
1 2 3 
3 2 1 
3 2 1 
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: 15ms
memory: 3524kb

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

result:

ok Correct (7545 test cases)

Test #35:

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

input:

1
200000 1 320 613 1

output:

NO

result:

ok Correct (1 test case)

Test #36:

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

input:

1
200000 1 37 328 1

output:

NO

result:

ok Correct (1 test case)

Test #37:

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

input:

1
200000 1 119733 157102 1

output:

NO

result:

ok Correct (1 test case)

Test #38:

score: 17
Accepted
time: 83ms
memory: 26760kb

input:

1
199920 1 392 510 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 #39:

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

input:

1
200000 1 201 860 1

output:

NO

result:

ok Correct (1 test case)

Test #40:

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

input:

1
200000 1 91 436 1

output:

NO

result:

ok Correct (1 test case)

Test #41:

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

input:

1
200000 1 82406 192973 1

output:

NO

result:

ok Correct (1 test case)

Test #42:

score: 17
Accepted
time: 86ms
memory: 26760kb

input:

1
199870 1 253 790 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 #43:

score: 17
Accepted
time: 87ms
memory: 23868kb

input:

2
171916 1 177 82364 1
28044 1 123 228 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 #44:

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

input:

2
103116 1 240 317 1
96884 1 20 1362 1

output:

NO
NO

result:

ok Correct (2 test cases)

Test #45:

score: 17
Accepted
time: 85ms
memory: 24392kb

input:

2
23087 1 6 2290 1
176913 1 161 67795 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 (2 test cases)

Test #46:

score: 17
Accepted
time: 77ms
memory: 20956kb

input:

2
143057 1 302 474 1
56943 1 23 28465 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 #47:

score: 17
Accepted
time: 52ms
memory: 20344kb

input:

2
63028 1 16 184 1
136972 1 321 427 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 (2 test cases)

Test #48:

score: 17
Accepted
time: 13ms
memory: 7364kb

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
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 #49:

score: 17
Accepted
time: 23ms
memory: 6820kb

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
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 #50:

score: 17
Accepted
time: 72ms
memory: 15856kb

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
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 #51:

score: 17
Accepted
time: 45ms
memory: 8596kb

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
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 (20 test cases)

Test #52:

score: 17
Accepted
time: 12ms
memory: 4480kb

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
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 10...

result:

ok Correct (20 test cases)

Test #53:

score: 17
Accepted
time: 32ms
memory: 4972kb

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
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 (100 test cases)

Test #54:

score: 17
Accepted
time: 24ms
memory: 3912kb

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
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 (1000 test cases)

Test #55:

score: 17
Accepted
time: 23ms
memory: 3828kb

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
1 2 3 4 5 6 7 8 9 10 11 12 
12 11 10 9 8 7 6 5 4 3 2 1 
4 3 2 1 8 7 6 5 12 11 10 9 
NO
NO
YES
1 2 3 4 5 
5 4 3 2 1 
3 2 1 4 5 
NO
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 
14 13 12 11 10 9 8 7 6 5 4 3 2 1 16 15 17 18 19 20 
NO
NO
...

result:

ok Correct (10000 test cases)

Test #56:

score: 17
Accepted
time: 22ms
memory: 3588kb

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
1 2 3 4 5 6 7 8 
8 7 6 5 4 3 2 1 
4 3 2 1 8 7 6 5 
NO
YES
1 
1 
1 
YES
1 2 3 
3 2 1 
3 2 1 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 
5 4 3 2 1 10 9 8 7 6 15 14 13 12 11 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 
4 3 2...

result:

ok Correct (20000 test cases)

Test #57:

score: 17
Accepted
time: 37ms
memory: 3524kb

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
1 2 
2 1 
2 1 
YES
1 2 3 
3 2 1 
3 2 1 
NO
YES
1 
1 
1 
NO
YES
1 2 
2 1 
2 1 
YES
1 2 
2 1 
2 1 
NO
NO
NO
YES
1 2 3 4 
4 3 2 1 
4 3 2 1 
YES
1 2 3 
3 2 1 
3 2 1 
YES
1 2 3 4 
4 3 2 1 
2 1 4 3 
YES
1 
1 
1 
YES
1 2 
2 1 
2 1 
YES
1 2 
2 1 
2 1 
YES
1 2 3 
3 2 1 
3 2 1 
YES
1 2 3 
3 2 1 
3 2 1 
YE...

result:

ok Correct (50000 test cases)

Subtask #5:

score: 22
Accepted

Test #58:

score: 22
Accepted
time: 2ms
memory: 3848kb

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: 22
Accepted
time: 0ms
memory: 3792kb

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

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: 22
Accepted
time: 0ms
memory: 3832kb

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

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: 22
Accepted
time: 0ms
memory: 3540kb

input:

1
530 313 320 377 0

output:

YES

result:

ok Correct (1 test case)

Test #64:

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

input:

1
200000 2 2 199999 0

output:

YES

result:

ok Correct (1 test case)

Test #65:

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

input:

1
200000 39866 96910 119733 0

output:

YES

result:

ok Correct (1 test case)

Test #66:

score: 22
Accepted
time: 0ms
memory: 3796kb

input:

1
192962 36 40 134 0

output:

NO

result:

ok Correct (1 test case)

Test #67:

score: 22
Accepted
time: 0ms
memory: 3536kb

input:

1
888 201 225 833 0

output:

YES

result:

ok Correct (1 test case)

Test #68:

score: 22
Accepted
time: 0ms
memory: 3604kb

input:

1
200000 2 2 199999 0

output:

YES

result:

ok Correct (1 test case)

Test #69:

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

input:

1
200000 75873 82406 104420 0

output:

YES

result:

ok Correct (1 test case)

Test #70:

score: 22
Accepted
time: 0ms
memory: 3836kb

input:

1
84478 19 57 78 0

output:

NO

result:

ok Correct (1 test case)

Test #71:

score: 22
Accepted
time: 0ms
memory: 3548kb

input:

2
97 40 41 43 0
8427 8 9 117 0

output:

YES
NO

result:

ok Correct (2 test cases)

Test #72:

score: 22
Accepted
time: 0ms
memory: 3824kb

input:

2
2515 41 240 1573 0
300 2 161 290 0

output:

YES
NO

result:

ok Correct (2 test cases)

Test #73:

score: 22
Accepted
time: 0ms
memory: 3540kb

input:

2
187 6 123 182 0
176913 59051 73817 134152 0

output:

NO
YES

result:

ok Correct (2 test cases)

Test #74:

score: 22
Accepted
time: 0ms
memory: 3764kb

input:

2
75208 28 34 79 0
4802 8 20 30 0

output:

YES
NO

result:

ok Correct (2 test cases)

Test #75:

score: 22
Accepted
time: 0ms
memory: 3620kb

input:

2
63028 2 2 63027 0
840 11 80 163 0

output:

YES
YES

result:

ok Correct (2 test cases)

Test #76:

score: 22
Accepted
time: 0ms
memory: 3492kb

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: 22
Accepted
time: 0ms
memory: 3600kb

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: 22
Accepted
time: 0ms
memory: 3628kb

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: 22
Accepted
time: 0ms
memory: 3612kb

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: 22
Accepted
time: 0ms
memory: 3608kb

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: 22
Accepted
time: 0ms
memory: 3608kb

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: 22
Accepted
time: 0ms
memory: 3640kb

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: 22
Accepted
time: 2ms
memory: 3848kb

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: 22
Accepted
time: 3ms
memory: 3544kb

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: 22
Accepted
time: 5ms
memory: 3552kb

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

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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 
19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 21 
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 19 18 17 20 21 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 
17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 18 19 20 21 
10 9 8 7 6 5 4...

result:

ok Correct (11753 test cases)

Test #87:

score: 40
Accepted
time: 1ms
memory: 3780kb

input:

1
530 313 320 377 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 #88:

score: 40
Accepted
time: 27ms
memory: 17420kb

input:

1
200000 2 2 199999 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 #89:

score: 40
Accepted
time: 90ms
memory: 38204kb

input:

1
200000 39866 96910 119733 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 #90:

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

input:

1
192962 36 40 134 1

output:

NO

result:

ok Correct (1 test case)

Test #91:

score: 40
Accepted
time: 1ms
memory: 4004kb

input:

1
888 201 225 833 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 #92:

score: 40
Accepted
time: 27ms
memory: 17404kb

input:

1
200000 2 2 199999 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 #93:

score: 40
Accepted
time: 80ms
memory: 47128kb

input:

1
200000 75873 82406 104420 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 #94:

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

input:

1
84478 19 57 78 1

output:

NO

result:

ok Correct (1 test case)

Test #95:

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

input:

2
97 40 41 43 1
8427 8 9 117 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 
58 59 60 55 5...

result:

ok Correct (2 test cases)

Test #96:

score: 40
Accepted
time: 1ms
memory: 3940kb

input:

2
2515 41 240 1573 1
300 2 161 290 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 #97:

score: 40
Accepted
time: 71ms
memory: 39672kb

input:

2
187 6 123 182 1
176913 59051 73817 134152 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 (2 test cases)

Test #98:

score: 40
Accepted
time: 51ms
memory: 13036kb

input:

2
75208 28 34 79 1
4802 8 20 30 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 #99:

score: 40
Accepted
time: 8ms
memory: 7940kb

input:

2
63028 2 2 63027 1
840 11 80 163 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 #100:

score: 40
Accepted
time: 20ms
memory: 6120kb

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
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 #101:

score: 40
Accepted
time: 23ms
memory: 7112kb

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
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 #102:

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

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
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 #103:

score: 40
Accepted
time: 9ms
memory: 5068kb

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
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 
64 63 61 62 59 60 57 58 55 56 53 54 51 52 49 50 47 48 45 46 43 44 41 42 39 4...

result:

ok Correct (20 test cases)

Test #104:

score: 40
Accepted
time: 25ms
memory: 8792kb

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
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 #105:

score: 40
Accepted
time: 18ms
memory: 4584kb

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
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 
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 44 45 46 47 48 49 5...

result:

ok Correct (100 test cases)

Test #106:

score: 40
Accepted
time: 20ms
memory: 4116kb

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
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 (1000 test cases)

Test #107:

score: 40
Accepted
time: 21ms
memory: 4072kb

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
1 2 
2 1 
2 1 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 
14 13 12 11 10 9 8 7 6 5 4 3 2 1 
11 10 9 8 7 6 5 4 3 2 1 13 12 14 
NO
YES
1 2 3 4 5 6 7 8 9 
9 8 7 6 5 4 3 1 2 
9 8 7 6 5 4 1 3 2 
NO
YES
1 2 3 4 5 6 7 
7 6 5 4 3 2 1 
6 5 4 3 2 1 7 
YES
1 2 
2 1 
2 1 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...

result:

ok Correct (10000 test cases)

Test #108:

score: 40
Accepted
time: 25ms
memory: 3660kb

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
1 2 3 4 5 
5 4 3 2 1 
5 4 3 2 1 
YES
1 
1 
1 
NO
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 
YES
1 2 3 4 5 6 7 8 
8 7 6 5 4 3 2 1 
5 4 3 2 1 8 7 6 
NO
YES
1 
1 
1 
NO
NO
YES
1 2 3 
3 2 1 
3 2 1 
YES
1 2 
2 1 
2 1 
NO
YES
1...

result:

ok Correct (20000 test cases)

Test #109:

score: 40
Accepted
time: 33ms
memory: 3876kb

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
1 2 
2 1 
2 1 
YES
1 2 3 
3 2 1 
3 2 1 
NO
YES
1 
1 
1 
YES
1 2 3 4 5 
5 4 3 2 1 
4 3 2 1 5 
YES
1 2 
2 1 
2 1 
YES
1 
1 
1 
YES
1 2 
2 1 
2 1 
YES
1 2 
2 1 
2 1 
YES
1 2 3 4 5 6 
6 5 4 3 1 2 
6 5 4 1 3 2 
NO
YES
1 2 3 
3 2 1 
3 2 1 
NO
YES
1 
1 
1 
YES
1 2 
2 1 
2 1 
YES
1 
1 
1 
YES
1 2 3 
3 2...

result:

ok Correct (50000 test cases)