QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#305151#5002. Distance and Treeezteam1#AC ✓9ms14276kbC++141.8kb2024-01-14 19:14:422024-01-14 19:14:43

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 8812kb

input:

5
0 1 2 1 3

output:

-1

result:

ok Accepted

Test #2:

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

input:

5
1 1 0 1 1

output:

1 3
2 3
4 3
5 3

result:

ok Accepted

Test #3:

score: 0
Accepted
time: 9ms
memory: 13124kb

input:

100000
96770 96764 96762 96761 96759 96755 96754 96753 96752 96751 96750 96748 96746 96745 96741 96740 96739 96736 96735 96734 96730 96728 96727 96726 96723 96718 96714 96712 96710 96709 96706 96705 96704 96703 96702 96698 96697 96696 96695 96693 96692 96690 96687 96684 96683 96682 96681 96679 96677...

output:

1 96771
2 96766
3 4
4 96765
5 96764
6 7
7 8
8 9
9 10
10 11
11 96761
12 96760
13 14
14 96759
15 16
16 17
17 96756
18 19
19 20
20 96754
21 96751
22 23
23 24
24 96750
25 96748
26 96744
27 96741
28 96740
29 30
30 96739
31 32
32 33
33 34
34 35
35 96737
36 37
37 38
38 39
39 96734
40 41
41 96733
42 96732
4...

result:

ok Accepted

Test #4:

score: 0
Accepted
time: 9ms
memory: 14276kb

input:

100000
36370 36368 36365 36364 36362 36360 36356 36355 36354 36351 36349 36348 36336 36332 36331 36329 36327 36326 36325 36324 36321 36318 36317 36315 36314 36310 36308 36305 36304 36303 36299 36297 36295 36294 36291 36290 36289 36286 36284 36283 36280 36279 36276 36275 36273 36271 36269 36268 36267...

output:

1 36371
2 36370
3 4
4 36368
5 36367
6 36366
7 8
8 9
9 36363
10 36361
11 12
12 36360
13 36349
14 15
15 36346
16 36345
17 18
18 19
19 20
20 36344
21 36342
22 23
23 36340
24 25
25 36339
26 36336
27 36335
28 29
29 30
30 36333
31 36330
32 36329
33 34
34 36328
35 36
36 37
37 36326
38 36324
39 40
40 36323
...

result:

ok Accepted

Test #5:

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

input:

100000
62834 62837 62839 62841 62844 62845 62849 62850 62852 62853 62854 62855 62857 62859 62863 62866 62867 62871 62873 62875 62876 62877 62880 62882 62885 62887 62888 62889 62890 62892 62894 62897 62898 62899 62905 62909 62910 62913 62914 62915 62916 62917 62918 62919 62920 62921 62922 62923 62925...

output:

1 100000
2 37165
3 37164
4 37163
5 37161
6 5
7 37158
8 7
9 37157
10 9
11 10
12 11
13 37156
14 37155
15 37152
16 37150
17 16
18 37147
19 37146
20 37145
21 20
22 21
23 37143
24 37142
25 37140
26 37139
27 26
28 27
29 28
30 37138
31 37137
32 37135
33 32
34 33
35 37130
36 37127
37 36
38 37125
39 38
40 39...

result:

ok Accepted

Test #6:

score: 0
Accepted
time: 9ms
memory: 12844kb

input:

100000
57363 57369 57371 57372 57373 57375 57376 57378 57380 57383 57385 57389 57390 57394 57395 57396 57399 57401 57402 57403 57406 57409 57410 57412 57422 57423 57425 57426 57429 57432 57433 57438 57439 57441 57444 57448 57449 57450 57455 57458 57462 57463 57468 57469 57472 57475 57476 57477 57478...

output:

1 42638
2 42633
3 42632
4 3
5 4
6 42631
7 6
8 42630
9 42629
10 42627
11 42626
12 42623
13 12
14 42620
15 14
16 15
17 42618
18 42617
19 18
20 19
21 42615
22 42613
23 22
24 42612
25 42603
26 25
27 42602
28 27
29 42600
30 42598
31 30
32 42594
33 32
34 42593
35 42591
36 42588
37 36
38 37
39 42584
40 425...

result:

ok Accepted

Test #7:

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

input:

100000
55980 55983 55985 55987 55988 55991 55992 55993 55994 55995 55996 55997 55999 56005 56008 56009 56011 56014 56015 56017 56018 56028 56029 56033 56035 56037 56038 56040 56044 56050 56051 56055 56058 56062 56064 56070 56074 56076 56079 56082 56083 56085 56086 56087 56089 56091 56092 56095 56099...

output:

1 100000
2 44019
3 44018
4 44017
5 4
6 44015
7 6
8 7
9 8
10 9
11 10
12 11
13 44014
14 44009
15 44007
16 15
17 44006
18 44004
19 18
20 44003
21 20
22 43994
23 22
24 43991
25 43990
26 43989
27 26
28 43988
29 43985
30 43980
31 30
32 43977
33 43975
34 43972
35 43971
36 43966
37 43963
38 43962
39 43960
4...

result:

ok Accepted

Test #8:

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

input:

1000
582 580 578 575 574 570 569 559 558 557 555 553 551 550 549 548 546 544 543 542 541 534 531 529 528 525 524 523 521 520 519 517 514 502 500 498 496 495 494 493 491 490 486 484 483 477 474 473 472 471 470 469 468 466 465 464 461 459 458 453 449 448 445 444 440 439 438 436 435 434 433 432 428 425...

output:

1 583
2 582
3 581
4 5
5 579
6 7
7 576
8 9
9 10
10 567
11 566
12 565
13 14
14 15
15 16
16 564
17 563
18 19
19 20
20 21
21 562
22 556
23 554
24 25
25 553
26 27
27 28
28 551
29 30
30 31
31 550
32 549
33 547
34 536
35 535
36 534
37 38
38 39
39 40
40 533
41 42
42 532
43 529
44 45
45 528
46 523
47 48
48 4...

result:

ok Accepted

Test #9:

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

input:

1000
921 922 927 928 931 932 933 935 936 940 941 942 947 948 949 950 952 956 957 961 965 969 970 971 972 973 977 979 980 984 985 986 988 989 990 992 994 999 998 997 996 995 993 991 987 983 982 981 978 976 975 974 968 967 966 964 963 962 960 959 958 955 954 953 951 946 945 944 943 939 938 937 934 930...

output:

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

result:

ok Accepted

Test #10:

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

input:

1000
658 660 661 666 667 668 672 677 678 679 680 681 683 684 686 688 689 690 691 695 697 698 701 702 705 708 711 713 715 716 719 720 722 727 731 734 738 740 742 744 747 748 749 750 751 752 753 757 760 761 766 768 769 770 771 772 773 774 775 778 779 780 781 782 783 784 785 788 789 790 791 792 793 794...

output:

1 1000
2 342
3 2
4 338
5 4
6 5
7 335
8 331
9 8
10 9
11 10
12 11
13 330
14 13
15 329
16 328
17 16
18 17
19 18
20 325
21 324
22 21
23 322
24 23
25 320
26 318
27 316
28 315
29 314
30 29
31 312
32 31
33 311
34 307
35 304
36 302
37 299
38 298
39 297
40 296
41 294
42 41
43 42
44 43
45 44
46 45
47 46
48 29...

result:

ok Accepted

Test #11:

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

input:

1000
221 222 225 226 229 230 231 232 235 236 237 238 240 242 243 244 245 246 248 250 253 254 255 256 263 266 269 271 272 274 275 276 277 279 280 282 284 285 286 287 290 295 296 299 301 302 304 305 307 310 312 313 314 315 317 319 320 324 325 329 334 337 339 344 345 346 348 351 352 355 357 361 362 363...

output:

1 780
2 1
3 778
4 3
5 776
6 5
7 6
8 7
9 774
10 9
11 10
12 11
13 773
14 772
15 14
16 15
17 16
18 17
19 771
20 770
21 768
22 21
23 22
24 23
25 762
26 760
27 758
28 757
29 28
30 756
31 30
32 31
33 32
34 755
35 34
36 754
37 753
38 37
39 38
40 39
41 751
42 747
43 42
44 745
45 744
46 45
47 743
48 47
49 74...

result:

ok Accepted

Test #12:

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

input:

1000
186 187 188 189 190 191 194 196 199 201 203 205 206 210 211 212 213 216 217 219 220 221 223 229 231 235 240 241 243 244 245 246 247 248 250 255 257 258 259 262 263 264 266 267 268 269 272 273 275 276 278 281 282 283 284 291 292 294 301 302 304 305 307 311 316 317 318 319 322 326 327 328 333 334...

output:

1 1000
2 1
3 2
4 3
5 4
6 5
7 813
8 812
9 810
10 809
11 808
12 807
13 12
14 804
15 14
16 15
17 16
18 802
19 18
20 801
21 20
22 21
23 800
24 795
25 794
26 791
27 787
28 27
29 786
30 29
31 30
32 31
33 32
34 33
35 785
36 781
37 780
38 37
39 38
40 778
41 40
42 41
43 777
44 43
45 44
46 45
47 775
48 47
49 ...

result:

ok Accepted

Test #13:

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

input:

10
4 3 2 1 0 5 6 9 8 7

output:

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

result:

ok Accepted

Test #14:

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

input:

10
0 1 4 5 9 8 7 6 3 2

output:

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

result:

ok Accepted

Test #15:

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

input:

10
5 6 8 9 7 3 0 1 2 4

output:

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

result:

ok Accepted

Test #16:

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

input:

10
3 0 1 2 7 9 8 6 5 4

output:

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

result:

ok Accepted

Test #17:

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

input:

10
5 9 8 7 6 0 1 2 3 4

output:

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

result:

ok Accepted

Test #18:

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

input:

50000
22746 22745 22743 22742 22739 22735 22733 22732 22731 22729 22727 22724 22722 22720 22719 22717 22716 22714 22713 22708 22707 22706 22705 22703 22702 22700 22698 22693 22692 22689 22687 22685 22683 22682 22680 22679 22678 22676 22674 22671 22667 22665 22664 22661 22659 22658 22656 22650 22649 ...

output:

1 2
2 22747
3 4
4 22746
5 22744
6 22741
7 8
8 9
9 22740
10 22739
11 22738
12 22736
13 22735
14 15
15 22734
16 17
17 22733
18 19
19 22732
20 21
21 22
22 23
23 22728
24 25
25 22727
26 22726
27 22725
28 29
29 22721
30 22719
31 22718
32 22717
33 34
34 22716
35 36
36 37
37 22715
38 22714
39 22713
40 2271...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 5ms
memory: 12012kb

input:

50000
27526 27521 27520 27519 27517 27511 27506 27505 27504 27499 27497 27495 27492 27490 27489 27488 27486 27482 27481 27480 27478 27477 27476 27475 27474 27473 27468 27467 27466 27465 27463 27462 27461 27460 27455 27454 27452 27451 27449 27448 27447 27445 27444 27442 27441 27440 27439 27438 27436 ...

output:

1 27527
2 3
3 4
4 27523
5 27522
6 27517
7 8
8 9
9 27513
10 27509
11 27508
12 27507
13 27505
14 15
15 16
16 27504
17 27503
18 19
19 20
20 27500
21 22
22 23
23 24
24 25
25 26
26 27499
27 28
28 29
29 30
30 27495
31 32
32 33
33 34
34 27494
35 36
36 27490
37 38
38 27489
39 40
40 41
41 27488
42 43
43 2748...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 5ms
memory: 11236kb

input:

50000
18177 18178 18180 18181 18182 18183 18184 18185 18186 18188 18189 18190 18193 18194 18195 18196 18198 18200 18204 18206 18209 18212 18214 18215 18217 18218 18220 18221 18223 18226 18228 18230 18232 18234 18235 18236 18237 18238 18239 18240 18243 18244 18246 18248 18249 18250 18251 18254 18255 ...

output:

1 31824
2 1
3 31823
4 3
5 4
6 5
7 6
8 7
9 8
10 31822
11 10
12 11
13 31820
14 13
15 14
16 15
17 31819
18 31818
19 31815
20 31814
21 31812
22 31810
23 31809
24 23
25 31808
26 25
27 31807
28 27
29 31806
30 31804
31 31803
32 31802
33 31801
34 31800
35 34
36 35
37 36
38 37
39 38
40 39
41 31798
42 41
43 3...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 5ms
memory: 10860kb

input:

50000
13195 13194 13193 13192 13191 13190 13186 13184 13181 13180 13179 13176 13172 13168 13166 13160 13159 13158 13156 13155 13154 13151 13150 13149 13148 13147 13145 13144 13142 13141 13138 13137 13135 13133 13132 13131 13130 13127 13126 13125 13124 13122 13121 13119 13113 13112 13111 13109 13106 ...

output:

1 2
2 3
3 4
4 5
5 6
6 13196
7 13193
8 13192
9 10
10 11
11 13190
12 13188
13 13185
14 13182
15 13181
16 17
17 18
18 13176
19 20
20 21
21 13175
22 23
23 24
24 25
25 26
26 13173
27 28
28 13172
29 30
30 13171
31 32
32 13169
33 13168
34 35
35 36
36 37
37 13167
38 39
39 40
40 41
41 13165
42 43
43 13164
44...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 5ms
memory: 10696kb

input:

50000
1852 1856 1857 1858 1859 1860 1862 1868 1871 1873 1874 1875 1876 1877 1878 1879 1880 1882 1883 1885 1888 1891 1892 1896 1897 1898 1899 1901 1902 1904 1907 1910 1913 1914 1915 1916 1919 1922 1924 1933 1934 1939 1942 1943 1944 1945 1946 1947 1951 1952 1954 1958 1959 1960 1963 1967 1971 1972 1974...

output:

1 50000
2 48146
3 2
4 3
5 4
6 5
7 48145
8 48140
9 48138
10 48137
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 48136
19 18
20 48135
21 48133
22 48131
23 22
24 48128
25 24
26 25
27 26
28 48127
29 28
30 48126
31 48124
32 48122
33 48120
34 33
35 34
36 35
37 48118
38 48116
39 48115
40 48107
41 40
42 4810...

result:

ok Accepted

Test #23:

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

input:

10
0 1 2 3 4 1 3 4 2 3

output:

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

result:

ok Accepted

Test #24:

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

input:

100000
14879 87590 37413 82877 91816 99368 57722 18313 13232 60892 82794 83615 74864 40543 14870 85014 43195 10372 6873 49345 74272 13216 63600 69518 67189 49138 85317 50772 14868 77474 80767 29747 65064 18180 28977 56880 33900 86699 91545 47133 63943 90691 30748 55160 47586 61970 40174 90782 72342 ...

output:

-1

result:

ok Accepted

Test #25:

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

input:

100000
81178 95341 24040 3728 26335 48898 35932 98152 927 65240 82807 15496 29663 67304 7197 54578 66546 18582 8041 5923 5729 76555 53351 92767 61036 29539 68463 2428 7564 43887 41361 5095 39228 81753 8823 81916 30651 44755 96420 47930 26348 79228 63426 56011 62884 86975 26942 45782 5558 34983 51705...

output:

-1

result:

ok Accepted

Test #26:

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

input:

100000
53577 25315 53433 30671 6467 2872 84147 91912 85319 61542 47611 80695 26481 99184 41582 3433 77823 89796 77230 82767 28980 12731 72640 93192 69769 10999 26066 18889 52239 85327 83628 22168 26994 37062 52839 49814 39934 36986 41726 41605 14880 89338 22300 57713 4874 63882 61146 82697 70031 383...

output:

-1

result:

ok Accepted

Test #27:

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

input:

100000
81135 8663 9164 19316 86324 40203 5062 19568 82356 42929 5927 82216 98924 58933 66389 82692 72054 67580 12241 11633 81401 2763 38411 10157 74285 93803 99394 5099 38298 26499 11008 19433 51514 20172 38749 37838 76728 60163 73758 75436 3093 79685 57652 2017 38619 40394 84709 27025 7974 13303 38...

output:

-1

result:

ok Accepted

Test #28:

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

input:

100000
50905 98560 21701 12345 66048 48067 82660 29832 54525 71372 78765 94726 45795 66860 44975 87565 46302 72141 648 90792 39614 84964 12322 57149 78604 33000 56676 60927 43448 30819 1490 10706 29380 39543 39403 95428 87610 38415 25260 42135 9788 4026 53213 55583 87238 14540 59500 49892 86681 6014...

output:

-1

result:

ok Accepted

Test #29:

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

input:

1000
389 253 88 629 904 706 826 449 986 6 831 427 363 977 557 421 177 379 868 525 151 489 590 180 636 869 465 775 663 459 91 52 712 532 33 968 238 859 769 224 217 953 3 580 282 561 1 459 940 221 337 91 62 927 271 699 148 736 826 811 547 918 215 612 450 248 580 40 459 702 264 677 655 267 609 937 180 ...

output:

-1

result:

ok Accepted

Test #30:

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

input:

1000
790 91 483 213 442 184 2 936 155 65 927 281 302 281 221 399 823 2 158 68 766 977 962 992 371 127 856 921 808 540 943 950 983 426 164 426 610 518 714 117 935 641 399 589 274 972 989 449 327 147 518 445 476 480 437 199 959 645 120 768 186 415 70 521 842 586 299 804 105 13 274 392 7 673 982 281 99...

output:

-1

result:

ok Accepted

Test #31:

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

input:

1000
567 319 394 372 340 194 966 619 998 93 366 99 125 694 335 498 367 216 274 198 349 138 618 644 115 897 245 338 560 499 4 479 170 398 851 862 944 817 481 942 910 847 393 35 894 729 533 261 297 159 811 646 298 781 642 765 679 887 103 239 738 459 718 261 858 922 123 802 91 605 97 2 452 842 389 698 ...

output:

-1

result:

ok Accepted

Test #32:

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

input:

1000
692 429 923 196 573 950 350 696 594 53 802 151 459 735 550 873 632 715 78 602 573 823 793 127 712 311 896 956 82 692 872 775 121 795 323 46 746 673 94 692 79 248 196 890 336 746 115 320 813 194 923 386 17 68 866 729 731 762 37 166 806 909 293 279 705 616 678 803 289 772 495 720 373 691 610 61 7...

output:

-1

result:

ok Accepted

Test #33:

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

input:

1000
202 510 838 645 383 283 551 693 689 882 473 723 45 573 294 598 433 569 27 681 676 756 407 105 21 528 844 963 876 40 619 430 902 457 427 285 92 978 330 781 860 803 857 905 377 151 855 162 721 882 844 749 638 251 206 11 131 50 974 359 442 945 789 344 754 216 981 847 546 312 980 406 115 837 663 84...

output:

-1

result:

ok Accepted

Test #34:

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

input:

10
5 6 6 7 4 1 5 8 8 6

output:

-1

result:

ok Accepted

Test #35:

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

input:

10
6 0 1 1 2 8 1 0 5 3

output:

-1

result:

ok Accepted

Test #36:

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

input:

10
2 1 5 4 0 3 9 7 6 9

output:

-1

result:

ok Accepted

Test #37:

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

input:

10
9 8 7 8 7 5 4 5 9 6

output:

-1

result:

ok Accepted

Test #38:

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

input:

10
0 5 1 5 5 1 1 5 8 9

output:

-1

result:

ok Accepted

Test #39:

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

input:

50000
33913 532 38127 33353 3578 15234 43983 32672 22946 37844 32249 49533 3729 39801 21328 44522 11143 32850 33043 28846 32287 2258 16388 12556 37216 30241 34962 44478 32584 23184 21929 16498 23717 26408 16203 43647 41643 26538 26320 30941 30734 8569 30475 34463 14722 1803 45338 25865 1006 44733 21...

output:

-1

result:

ok Accepted

Test #40:

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

input:

50000
20498 38005 17560 14794 2319 19653 40349 34217 39094 23056 8668 43724 31914 17162 13977 39487 16082 20008 21394 39176 12096 6435 36270 30301 39025 36734 478 46842 122 13134 40439 20620 17491 8000 35415 19811 44005 42116 4028 49451 31524 12696 9528 29790 46210 23505 19278 12292 43514 7024 17820...

output:

-1

result:

ok Accepted

Test #41:

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

input:

50000
2078 12656 6446 27911 15092 29319 4809 10939 5717 22669 33900 42772 32276 18932 15047 44291 13239 29478 34243 36626 3998 43551 49800 16657 47172 13891 33427 15793 49884 25121 34792 18314 37777 7590 46225 19222 36910 17386 46513 42627 6408 46765 35399 5036 32049 16799 49328 45288 12629 49923 31...

output:

-1

result:

ok Accepted

Test #42:

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

input:

50000
26680 46058 18928 34937 26245 22060 3670 31236 44839 1362 10522 14491 39637 8281 7578 11167 22174 16412 5931 14446 4412 719 328 26397 11807 35659 34628 26146 20707 22121 20944 13739 34532 39872 48676 10777 28285 18699 8365 39476 36413 35239 20319 42402 43521 44250 3569 32047 10662 25852 12845 ...

output:

-1

result:

ok Accepted

Test #43:

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

input:

50000
37398 9325 44810 27451 9682 44314 36630 30210 20053 36304 48964 9937 12999 618 49834 44954 16297 33049 15847 35838 19363 38021 28378 47262 45179 12562 3229 41054 3119 19652 18101 40518 28977 29264 34321 5011 23578 20951 35222 9983 7256 538 19920 20255 1157 36106 31561 33806 19155 47408 35996 4...

output:

-1

result:

ok Accepted

Test #44:

score: 0
Accepted
time: 5ms
memory: 9596kb

input:

100000
0 2 1 1 2 1 2 1 2 1 1 1 1 1 3 3 2 1 2 1 3 2 3 1 1 1 1 1 2 2 1 1 2 1 2 1 2 1 1 2 1 1 1 2 1 1 1 1 2 3 1 1 2 1 2 2 2 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 2 2 1 2 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 2 1 1 2 1 2 1 1 2 1 1 1 1 1 1 2 1 3 3 2 3 1 1 1 1 1 2 1 2 2 1 2 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 2 1...

output:

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

result:

ok Accepted

Test #45:

score: 0
Accepted
time: 5ms
memory: 10852kb

input:

100000
0 2 2 1 1 1 3 2 1 1 3 2 3 1 1 4 3 2 1 1 1 2 2 2 2 2 1 1 2 3 1 2 1 1 1 2 3 1 4 3 2 1 1 1 2 1 2 1 2 1 1 1 2 1 1 1 2 2 2 2 1 1 1 2 1 2 1 1 2 2 1 2 2 1 2 1 2 1 2 2 1 2 1 2 2 2 2 1 1 1 2 4 3 1 1 2 1 1 2 2 1 1 3 3 2 2 3 1 1 1 1 2 1 1 2 1 2 1 1 2 1 2 2 3 1 2 1 2 1 3 2 2 1 2 1 1 2 1 1 4 3 2 3 3 1 2 2...

output:

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

result:

ok Accepted

Test #46:

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

input:

100000
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

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

result:

ok Accepted

Test #47:

score: 0
Accepted
time: 5ms
memory: 10764kb

input:

100000
0 2 1 2 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 1 1...

output:

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

result:

ok Accepted

Test #48:

score: 0
Accepted
time: 6ms
memory: 11476kb

input:

100000
0 2 1 2 2 2 3 2 2 1 2 2 2 2 2 1 2 2 1 2 2 1 1 2 1 3 2 3 2 1 2 3 1 3 2 3 1 2 2 2 2 1 3 2 3 1 3 3 3 4 2 3 1 1 1 2 2 2 2 2 2 2 2 1 4 5 3 4 3 5 4 5 3 2 4 3 4 1 2 3 2 2 2 2 3 1 1 2 2 2 2 2 2 2 1 2 4 3 2 3 2 2 2 3 3 2 2 3 2 2 3 2 3 2 3 2 2 2 1 1 3 2 1 2 3 4 1 2 2 2 2 2 2 2 1 2 1 2 2 4 3 2 2 2 2 2 2...

output:

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

result:

ok Accepted

Test #49:

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

input:

1000
0 3 2 1 1 1 1 2 1 3 2 2 3 1 1 1 1 2 2 3 3 1 2 2 2 1 1 2 1 2 3 2 1 1 1 1 1 1 1 2 1 1 2 1 1 3 2 3 2 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 1 1 1 1 1 1 3 2 1 2 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 2 3 2 1 1 2 2 2 2 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 1 2 1 1...

output:

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

result:

ok Accepted

Test #50:

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

input:

1000
0 2 1 2 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

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

result:

ok Accepted

Test #51:

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

input:

1000
0 1 1 2 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 2 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 3 2 1 1 1 1 2 1 1 2 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 2 2 1 2 1 2 1 2 1 1 2 1 1 1 1 2 1 1 2 2...

output:

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

result:

ok Accepted

Test #52:

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

input:

1000
0 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

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

result:

ok Accepted

Test #53:

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

input:

1000
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 3 1 1 1 2 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 2 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 2 1 1 2 1 1 1...

output:

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

result:

ok Accepted

Test #54:

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

input:

10
0 1 2 1 2 2 1 1 1 1

output:

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

result:

ok Accepted

Test #55:

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

input:

10
0 1 1 1 1 2 3 2 2 2

output:

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

result:

ok Accepted

Test #56:

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

input:

10
0 1 1 1 1 1 1 1 1 1

output:

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

result:

ok Accepted

Test #57:

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

input:

10
0 2 1 2 2 2 1 1 1 2

output:

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

result:

ok Accepted

Test #58:

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

input:

10
0 1 1 1 1 1 1 1 1 1

output:

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

result:

ok Accepted

Test #59:

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

input:

50000
0 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 2 1 1 1 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 2 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 3 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 ...

output:

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

result:

ok Accepted

Test #60:

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

input:

50000
0 1 1 2 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 2 1 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 ...

output:

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

result:

ok Accepted

Test #61:

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

input:

50000
0 1 1 2 1 2 1 1 1 2 1 1 2 1 1 2 1 2 2 3 2 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 1 2 1 2 1 2 1 2 1 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 3 2 2 1 1 1 1 1 1 2 2 1 1 1 2 2 2 2 1 1 1 2 1 2 1 1 1 1 1 1 2 1 2 1 1 2 2 1 1 2 1 1 1 1 1 2 1 1 2 3 3 1 1 3 2 2 2 1 1 2 1 3 2 3 3 1 1 1 1 1 2 1 3 2 2 1 2 ...

output:

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

result:

ok Accepted

Test #62:

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

input:

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

output:

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

result:

ok Accepted

Test #63:

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

input:

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

output:

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

result:

ok Accepted