QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#516899#4930. LCS of Permutationsegypt_ioi2024_03#43 158ms84864kbC++202.2kb2024-08-12 23:29:262024-08-12 23:29:26

詳細信息

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 73ms
memory: 3924kb

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: 158ms
memory: 19632kb

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: 132ms
memory: 13124kb

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: 115ms
memory: 11384kb

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: 108ms
memory: 7584kb

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: 89ms
memory: 4348kb

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: 49ms
memory: 3936kb

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: 66ms
memory: 3508kb

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: 34ms
memory: 3532kb

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

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: 122ms
memory: 33992kb

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: 36ms
memory: 84652kb

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: 37ms
memory: 84668kb

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: 128ms
memory: 24888kb

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: 31ms
memory: 84860kb

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

input:

1
200000 24843 82406 200000 1

output:

NO

result:

ok Correct (1 test case)

Test #18:

score: 10
Accepted
time: 35ms
memory: 84864kb

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: 123ms
memory: 17192kb

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: 43ms
memory: 25764kb

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: 126ms
memory: 25972kb

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: 115ms
memory: 32640kb

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: 64ms
memory: 39324kb

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: 70ms
memory: 23832kb

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: 70ms
memory: 27644kb

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: 39ms
memory: 48260kb

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: 67ms
memory: 16560kb

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: 43ms
memory: 18784kb

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: 43ms
memory: 9636kb

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: 46ms
memory: 4416kb

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: 40ms
memory: 3972kb

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: 45ms
memory: 3620kb

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: 71ms
memory: 3800kb

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: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Test #34:

score: 17
Accepted
time: 30ms
memory: 3880kb

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

input:

1
200000 1 320 613 1

output:

NO

result:

ok Correct (1 test case)

Test #36:

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

input:

1
200000 1 37 328 1

output:

NO

result:

ok Correct (1 test case)

Test #37:

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

input:

1
200000 1 119733 157102 1

output:

NO

result:

ok Correct (1 test case)

Test #38:

score: 17
Accepted
time: 111ms
memory: 19624kb

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

input:

1
200000 1 201 860 1

output:

NO

result:

ok Correct (1 test case)

Test #40:

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

input:

1
200000 1 91 436 1

output:

NO

result:

ok Correct (1 test case)

Test #41:

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

input:

1
200000 1 82406 192973 1

output:

NO

result:

ok Correct (1 test case)

Test #42:

score: 17
Accepted
time: 116ms
memory: 19764kb

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: 0
Time Limit Exceeded

input:

2
171916 1 177 82364 1
28044 1 123 228 1

output:


result:


Subtask #5:

score: 22
Accepted

Test #58:

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

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

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

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

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

input:

1
530 313 320 377 0

output:

YES

result:

ok Correct (1 test case)

Test #64:

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

input:

1
200000 2 2 199999 0

output:

YES

result:

ok Correct (1 test case)

Test #65:

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

input:

1
200000 39866 96910 119733 0

output:

YES

result:

ok Correct (1 test case)

Test #66:

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

input:

1
192962 36 40 134 0

output:

NO

result:

ok Correct (1 test case)

Test #67:

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

input:

1
888 201 225 833 0

output:

YES

result:

ok Correct (1 test case)

Test #68:

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

input:

1
200000 2 2 199999 0

output:

YES

result:

ok Correct (1 test case)

Test #69:

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

input:

1
200000 75873 82406 104420 0

output:

YES

result:

ok Correct (1 test case)

Test #70:

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

input:

1
84478 19 57 78 0

output:

NO

result:

ok Correct (1 test case)

Test #71:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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: 8ms
memory: 3544kb

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: 0
Skipped

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%