QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#687508#8581. 섬Estelle_N100 ✓234ms59532kbC++141.5kb2024-10-29 19:25:222024-10-29 19:25:28

Judging History

你现在查看的是最新测评结果

  • [2024-10-29 19:25:28]
  • 评测
  • 测评结果:100
  • 用时:234ms
  • 内存:59532kb
  • [2024-10-29 19:25:22]
  • 提交

answer

#include "island.h"
#include <set>
#include <queue>
#include <array>
#include <vector>

using namespace std;

const int MAXN = 200005;

int deg[MAXN];

queue <int> q;
set <int> e[MAXN];
vector < array <int, 2> > ans[2];

void add(int u, int v)
{
    ++ deg[u];
    ++ deg[v];
    e[u].insert(v);
    e[v].insert(u);
}

void construct_two_trees(int N, std::vector<int> U, std::vector<int> V)
{
    for(int i = 0; i < N; ++ i)
        add(i, (i + 1) % N);
    for(int i = 0; i < N - 3; ++ i)
        add(U[i], V[i]);

    for(int i = 0; i < N; ++ i)
    {
        if(deg[i] != 2)
            continue;
        int u = *e[i].begin(), v = *next(e[i].begin());
        add_vertex(i, u, v);
        add(i, N);
        add(u, N);
        add(v, N);
        ans[0].push_back({i, u});
        ans[0].push_back({i, v});
        ans[0].push_back({u, N});
        ans[1].push_back({u, v});
        ans[1].push_back({v, N});
        ans[1].push_back({i, N});
        break;
    }

    for(int i = 0; i <= N; ++ i)
        if(deg[i] == 2)
            q.push(i);
    while(!q.empty())
    {
        int u = q.front(), x = *e[u].begin(), y = *next(e[u].begin());
        q.pop();
        ans[0].push_back({u, x});
        ans[1].push_back({u, y});
        e[x].erase(u);
        e[y].erase(u);
        if(-- deg[x] == 2)
            q.push(x);
        if(-- deg[y] == 2)
            q.push(y);
    }
    report(ans[0]);
    report(ans[1]);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 3ms
memory: 13176kb

input:

4
0 2

output:

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

result:

ok Correct

Test #2:

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

input:

3

output:

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

result:

ok Correct

Test #3:

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

input:

4
3 1

output:

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

result:

ok Correct

Test #4:

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

input:

5
1 4
1 3

output:

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

result:

ok Correct

Subtask #2:

score: 8
Accepted

Test #5:

score: 8
Accepted
time: 3ms
memory: 13440kb

input:

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

output:

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

result:

ok Correct

Test #6:

score: 8
Accepted
time: 4ms
memory: 13676kb

input:

1000
10 919
10 561
10 671
10 430
10 425
10 987
10 608
10 401
10 467
10 850
10 207
10 99
10 864
10 907
10 590
10 410
10 3
10 236
10 546
10 455
10 694
10 651
10 193
10 295
10 910
10 929
10 151
10 157
10 869
10 453
10 587
10 800
10 988
10 832
10 7
10 723
10 172
10 628
10 432
10 527
10 702
10 328
10 895...

output:

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

result:

ok Correct

Test #7:

score: 8
Accepted
time: 0ms
memory: 15056kb

input:

5000
3653 4458
3653 4383
3653 1303
3653 3306
3653 3218
3653 2614
3653 4321
3653 959
3653 2749
3653 3926
3653 3679
3653 2498
3653 163
3653 1980
3653 3542
3653 1300
3653 4388
3653 4971
3653 3012
3653 711
3653 103
3653 3179
3653 4304
3653 4387
3653 1526
3653 4202
3653 3989
3653 810
3653 4756
3653 4029
...

output:

1
5000
3652 3651
3652 3653
3651 5000
3654 3653
3655 3653
3656 3653
3657 3653
3658 3653
3659 3653
3660 3653
3661 3653
3662 3653
3663 3653
3664 3653
3665 3653
3666 3653
3667 3653
3668 3653
3669 3653
3670 3653
3671 3653
3672 3653
3673 3653
3674 3653
3675 3653
3676 3653
3677 3653
3678 3653
3679 3653
368...

result:

ok Correct

Test #8:

score: 8
Accepted
time: 207ms
memory: 58992kb

input:

199999
98281 193703
98281 79970
98281 92443
98281 1621
98281 144687
98281 143302
98281 15416
98281 9245
98281 127092
98281 21325
98281 149110
98281 119923
98281 53885
98281 25820
98281 29852
98281 34700
98281 120142
98281 185421
98281 84923
98281 66458
98281 192051
98281 44169
98281 114692
98281 105...

output:

1
199999
98280 98279
98280 98281
98279 199999
98282 98281
98283 98281
98284 98281
98285 98281
98286 98281
98287 98281
98288 98281
98289 98281
98290 98281
98291 98281
98292 98281
98293 98281
98294 98281
98295 98281
98296 98281
98297 98281
98298 98281
98299 98281
98300 98281
98301 98281
98302 98281
98...

result:

ok Correct

Test #9:

score: 8
Accepted
time: 209ms
memory: 58940kb

input:

200000
175608 25000
175608 61359
175608 134288
175608 74838
175608 58154
175608 21892
175608 76830
175608 141171
175608 76397
175608 98232
175608 39276
175608 143602
175608 78284
175608 149754
175608 181632
175608 172252
175608 112871
175608 142010
175608 2821
175608 18165
175608 105580
175608 16460...

output:

1
200000
175607 175606
175607 175608
175606 200000
175609 175608
175610 175608
175611 175608
175612 175608
175613 175608
175614 175608
175615 175608
175616 175608
175617 175608
175618 175608
175619 175608
175620 175608
175621 175608
175622 175608
175623 175608
175624 175608
175625 175608
175626 1756...

result:

ok Correct

Subtask #3:

score: 14
Accepted

Test #10:

score: 14
Accepted
time: 7ms
memory: 14404kb

input:

5000
4593 3389
4593 1610
4593 2357
4593 3323
4593 2037
4593 3667
4593 2737
4593 2642
4593 3981
4593 2700
4593 2134
4593 1719
4593 1444
4593 3729
4593 1371
4593 546
4593 1249
4593 646
4593 4221
4593 1542
4593 2314
4735 4952
4593 680
4593 2555
4593 2152
4593 740
4593 4056
4593 64
4593 3079
4593 3021
4...

output:

1
5000
4592 4591
4592 4593
4591 5000
4951 4950
4950 4949
4949 4948
4948 4947
4947 4946
4946 4945
4945 4944
4944 4943
4943 4942
4942 4941
4941 4940
4940 4939
4939 4938
4938 4937
4937 4936
4936 4935
4935 4934
4934 4933
4933 4932
4932 4931
4931 4930
4930 4929
4929 4928
4928 4927
4927 4926
4926 4925
492...

result:

ok Correct

Test #11:

score: 14
Accepted
time: 6ms
memory: 14336kb

input:

5000
2039 2601
4753 3413
4753 4178
4753 3835
1179 2601
4753 3353
1382 2601
2310 2378
4753 3219
716 2601
1380 2601
4753 2757
4753 3561
4753 4236
4753 3289
1043 2601
4753 4154
4753 3226
144 2601
1791 2601
4753 3407
670 2601
685 2601
2217 2601
2310 2466
4753 3885
4753 3911
4753 3916
1999 2601
1057 2601...

output:

1
5000
2311 2310
2311 2312
2310 5000
4752 4751
4751 4750
4750 4749
4749 4748
4748 4747
4747 4746
4746 4745
4745 4744
4744 4743
4743 4742
4742 4741
4741 4740
4740 4739
4739 4738
4738 4737
4737 4736
4736 4735
4735 4734
4734 4733
4733 4732
4732 4731
4731 4730
4730 4729
4729 4728
4728 4727
4727 4726
472...

result:

ok Correct

Test #12:

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

input:

5000
3821 2308
3611 2536
3156 2615
4013 879
3821 1271
3252 2615
4235 4538
4235 527
3611 2504
4021 879
3821 2074
3821 1764
3821 2264
4235 4702
3821 1358
3821 1419
3821 1031
3821 2008
4145 879
3821 1756
3821 947
4235 532
3989 879
2882 2615
3821 1502
4235 338
4232 879
3821 1280
3621 2310
4235 4997
4235...

output:

1
5000
2616 2615
2616 2617
2615 5000
4236 4235
4237 4235
4238 4235
4239 4235
4240 4235
4241 4235
4242 4235
4243 4235
4244 4235
4245 4235
4246 4235
4247 4235
4248 4235
4249 4235
4250 4235
4251 4235
4252 4235
4253 4235
4254 4235
4255 4235
4256 4235
4257 4235
4258 4235
4259 4235
4260 4235
4261 4235
426...

result:

ok Correct

Test #13:

score: 14
Accepted
time: 3ms
memory: 15000kb

input:

5000
4291 1887
492 668
4405 1768
424 732
520 636
511 652
3249 2930
281 883
3798 2370
4497 1684
4314 1862
4589 1587
4128 2056
518 643
407 747
3666 2530
3911 2240
3656 2549
3804 2367
3221 2967
3340 2850
4644 1521
4696 1470
337 830
3200 3002
4958 1227
3690 2499
4052 2120
4584 1590
3454 2726
259 898
386...

output:

1
5000
585 584
585 586
584 5000
3102 3101
3101 3100
3103 3100
3104 3100
3100 3099
3099 3098
3098 3097
3105 3097
3106 3097
3097 3096
3096 3095
3095 3094
3107 3094
3094 3093
3108 3093
3109 3093
3093 3092
3092 3091
3110 3091
3091 3090
3090 3089
3089 3088
3088 3087
3087 3086
3111 3086
3112 3086
3113 308...

result:

ok Correct

Test #14:

score: 14
Accepted
time: 234ms
memory: 58992kb

input:

200000
118877 111067
118877 61677
118877 152911
118877 27918
118877 37129
118877 191189
134624 141257
118877 61841
118877 148131
118877 21099
118877 143149
118877 156253
118877 45282
118877 150038
118877 161995
118877 46438
118877 89345
118877 145634
118877 47579
118877 97199
118877 190418
131092 14...

output:

1
200000
118876 118875
118876 118877
118875 200000
141256 141255
141255 141254
141254 141253
141253 141252
141252 141251
141251 141250
141250 141249
141249 141248
141248 141247
141247 141246
141246 141245
141245 141244
141244 141243
141243 141242
141242 141241
141241 141240
141240 141239
141239 1412...

result:

ok Correct

Test #15:

score: 14
Accepted
time: 219ms
memory: 58988kb

input:

200000
88390 168647
95628 158381
3699 168647
85785 168647
179225 168647
183266 168647
7344 168647
24236 168647
95628 160429
19276 168647
86328 168647
95628 129751
57331 168647
175821 168647
97793 101151
65768 168647
6743 168647
55840 168647
191522 168647
4698 168647
83621 168647
502 168647
199723 16...

output:

1
200000
97794 97793
97794 97795
97793 200000
168648 168647
168649 168647
168650 168647
168651 168647
168652 168647
168653 168647
168654 168647
168655 168647
168656 168647
168657 168647
168658 168647
168659 168647
168660 168647
168661 168647
168662 168647
168663 168647
168664 168647
168665 168647
16...

result:

ok Correct

Test #16:

score: 14
Accepted
time: 208ms
memory: 58992kb

input:

200000
161198 97004
210 53673
137624 117065
14207 37004
198957 54106
19932 32268
4156 50957
128715 122872
193255 61086
18355 32844
185270 77269
197683 56140
22524 29748
128713 123448
161233 97004
24961 28006
5903 48877
184255 78389
26779 27404
189943 66162
185159 77301
153135 104684
144760 110015
63...

output:

1
200000
27192 27191
27192 27193
27191 200000
125496 125495
125495 125494
125494 125493
125493 125492
125492 125491
125491 125490
125490 125489
125489 125488
125488 125487
125487 125486
125486 125485
125485 125484
125484 125483
125483 125482
125482 125481
125481 125480
125480 125479
125479 125478
12...

result:

ok Correct

Test #17:

score: 14
Accepted
time: 194ms
memory: 58884kb

input:

200000
9334 71537
150066 130781
12423 68345
185572 95318
166764 114046
190669 89957
141566 139287
178491 102412
150154 130684
156112 124634
189635 91076
199409 81350
149472 131358
169382 111462
162985 117788
153862 126958
193845 86858
154186 126603
36618 44266
12743 67994
14703 65983
18551 62202
131...

output:

1
200000
40417 40416
40417 40418
40416 200000
140447 140446
140448 140446
140449 140446
140446 140445
140445 140444
140450 140444
140451 140444
140444 140443
140452 140443
140443 140442
140453 140442
140454 140442
140455 140442
140456 140442
140457 140442
140442 140441
140458 140441
140441 140440
14...

result:

ok Correct

Test #18:

score: 14
Accepted
time: 176ms
memory: 59004kb

input:

200000
158793 27013
165764 20041
185032 774
136799 49007
122621 63185
155289 30517
113076 72729
127181 58625
116217 69589
104909 80897
154955 30851
184644 1162
130883 54923
94053 91753
165440 20366
132519 53287
129041 56764
127346 58459
109588 76218
181004 4801
111065 74740
145125 40680
153496 32309...

output:

1
200000
92903 92902
92903 92904
92902 200000
192903 192902
192902 192901
192904 192901
192901 192900
192905 192900
192900 192899
192906 192899
192899 192898
192907 192898
192898 192897
192908 192897
192897 192896
192909 192896
192896 192895
192910 192895
192895 192894
192911 192894
192894 192893
19...

result:

ok Correct

Subtask #4:

score: 21
Accepted

Dependency #1:

100%
Accepted

Test #19:

score: 21
Accepted
time: 3ms
memory: 13464kb

input:

10
0 2
6 0
4 2
0 5
6 9
6 8
0 4

output:

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

result:

ok Correct

Test #20:

score: 21
Accepted
time: 3ms
memory: 14352kb

input:

4999
3847 3851
3126 3142
1188 300
4756 4752
526 484
928 930
3288 3297
1628 1603
2089 2091
2619 2643
2471 2481
1709 1718
1222 1266
3245 3235
31 35
3009 3306
4609 4612
3366 3362
3715 3813
550 545
630 692
3581 3584
3715 3713
747 743
1191 1205
4289 4286
469 467
3879 3876
168 170
520 518
1890 1888
4515 4...

output:

1
4999
1 0
1 2
0 4999
3 2
6 5
8 7
10 9
13 12
16 15
20 19
22 21
25 24
29 28
32 31
38 37
40 39
42 41
44 43
46 45
48 47
50 49
53 52
56 55
58 57
61 60
64 63
66 65
70 69
73 72
75 74
77 76
79 78
82 81
84 83
86 85
88 87
90 89
93 92
95 94
99 98
101 100
105 104
107 106
111 110
113 112
116 115
118 117
120 119...

result:

ok Correct

Test #21:

score: 21
Accepted
time: 2ms
memory: 14640kb

input:

5000
2923 2920
2307 2310
4952 4949
4327 4246
2332 2323
3794 3798
2344 2346
2927 2924
4437 4439
4529 4531
2634 2630
1847 1852
542 538
4607 4599
1011 1013
4696 4694
287 284
814 782
524 527
1362 1359
2558 2560
1095 1097
1432 1485
158 161
2395 2401
4738 4755
1481 1483
1044 1041
644 642
1122 1116
4341 43...

output:

1
5000
0 1
0 4999
1 5000
2 1
4 3
6 5
8 7
12 11
15 14
18 17
20 19
24 23
26 25
29 28
32 31
35 34
37 36
39 38
41 40
43 42
45 44
49 48
52 51
55 54
57 56
59 58
61 60
65 64
67 66
71 70
73 72
75 74
78 77
83 82
85 84
87 86
89 88
93 92
96 95
100 99
105 104
107 106
109 108
112 111
114 113
116 115
120 119
123 ...

result:

ok Correct

Test #22:

score: 21
Accepted
time: 2ms
memory: 14344kb

input:

4999
149 145
4651 4684
3354 3392
3453 3457
4314 4305
1036 1039
4915 4918
4229 4223
4554 4558
4176 4179
376 372
509 525
1057 1051
3361 3363
2724 2713
664 658
1608 1619
80 78
2040 2042
550 555
2126 2131
169 171
1590 1592
4593 4601
409 411
4863 4860
1306 1304
2177 2175
4770 4787
4981 4984
1225 1075
385...

output:

1
4999
1 0
1 2
0 4999
3 2
6 5
11 10
15 14
17 16
20 19
23 22
26 25
28 27
30 29
32 31
34 33
36 35
39 38
41 40
43 42
45 44
47 46
49 48
51 50
55 54
57 56
60 59
62 61
65 64
67 66
69 68
71 70
73 72
75 74
79 78
82 81
84 83
86 85
89 88
92 91
96 95
101 100
103 102
105 104
107 106
109 108
113 112
115 114
117 ...

result:

ok Correct

Test #23:

score: 21
Accepted
time: 5ms
memory: 14652kb

input:

5000
2054 2060
853 855
4655 4664
3349 3343
1871 1867
1136 1134
521 525
1263 1261
1885 1874
3482 3479
1857 1844
2878 2873
1588 1590
4648 4643
1737 1735
1414 1410
668 665
4673 4691
2404 2402
1198 1200
2559 2554
2287 2291
3284 3277
775 773
2763 2761
1550 1563
277 279
3249 3255
2689 2678
1167 1165
2886 ...

output:

1
5000
1 0
1 2
0 5000
3 2
6 5
8 7
10 9
12 11
16 15
18 17
20 19
23 22
25 24
27 26
30 29
32 31
35 34
38 37
40 39
42 41
44 43
46 45
50 49
54 53
56 55
58 57
60 59
62 61
66 65
68 67
70 69
73 72
76 75
79 78
81 80
84 83
86 85
88 87
90 89
92 91
94 93
98 97
101 100
103 102
105 104
107 106
109 108
111 110
113...

result:

ok Correct

Test #24:

score: 21
Accepted
time: 5ms
memory: 14632kb

input:

5000
866 197
4394 4396
156 158
1432 2482
2027 2242
1097 4080
4028 4030
4213 1069
824 408
1199 3552
270 272
923 4965
3383 3385
79 81
1438 2456
781 596
1587 2335
1381 2698
1206 3524
2888 1335
3134 1290
1968 1970
2665 2667
143 882
2633 2635
3957 3959
1163 3790
3596 3598
644 774
2318 1643
1670 1672
1447...

output:

1
5000
0 1
0 4999
1 5000
2 1
5 4
8 7
10 9
13 12
15 14
18 17
21 20
24 23
27 26
29 28
31 30
33 32
38 37
40 39
42 41
44 43
47 46
50 49
54 53
56 55
60 59
62 61
64 63
67 66
69 68
72 71
74 73
76 75
78 77
80 79
82 81
84 83
87 86
89 88
91 90
96 95
98 97
101 100
103 102
105 104
109 108
111 110
113 112
115 11...

result:

ok Correct

Test #25:

score: 21
Accepted
time: 5ms
memory: 14376kb

input:

5000
719 761
3798 3828
4884 4895
3424 3426
3317 3319
1016 642
2578 2636
1536 1528
3047 3045
74 93
4626 4629
366 371
3317 3315
4741 4746
4826 4831
3207 3205
743 745
2151 2172
4022 503
4095 4097
1421 1414
4580 4578
3682 521
814 833
4300 4298
2974 2994
4194 4215
1477 1474
3507 3509
1084 1102
4884 4894
...

output:

1
5000
2 1
2 3
1 5000
7 6
10 9
13 12
15 14
18 17
21 20
23 22
27 26
32 31
35 34
38 37
40 39
42 41
45 44
50 49
53 52
57 56
62 61
64 63
66 65
68 67
70 69
72 71
75 74
78 77
80 79
82 81
84 83
87 86
89 88
94 93
97 96
99 98
101 100
103 102
109 108
111 110
113 112
117 116
119 118
122 121
124 123
126 125
130...

result:

ok Correct

Subtask #5:

score: 51
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #26:

score: 51
Accepted
time: 29ms
memory: 21220kb

input:

36116
18381 18383
11621 11637
22299 22301
24728 24726
3498 3504
886 587
32847 32851
33791 33803
30069 30107
5997 5999
26321 26366
16446 16440
11937 11922
4403 4407
12733 12716
13879 13873
11239 11549
23205 23207
7495 7501
17254 17242
9657 9645
9771 9773
20920 20905
33118 33116
11115 11080
21952 2165...

output:

1
36116
0 1
0 36115
1 36116
2 1
6 5
8 7
10 9
14 13
16 15
18 17
20 19
23 22
25 24
27 26
31 30
33 32
37 36
40 39
42 41
47 46
49 48
53 52
55 54
57 56
59 58
62 61
64 63
68 67
71 70
74 73
76 75
78 77
82 81
84 83
88 87
95 94
97 96
100 99
102 101
105 104
107 106
112 111
114 113
116 115
118 117
120 119
122 ...

result:

ok Correct

Test #27:

score: 51
Accepted
time: 219ms
memory: 59292kb

input:

199999
44200 44198
104749 104747
144366 144368
93402 93399
69289 69293
150470 150478
144412 144409
59224 59222
116801 116799
184165 184163
83753 83756
29823 29816
149658 149660
88606 88604
190945 190947
66341 66362
169658 169646
94803 94848
181422 181400
198875 198934
7325 7330
187894 187865
86632 8...

output:

1
199999
1 0
1 2
0 199999
3 2
6 5
8 7
11 10
16 15
18 17
20 19
23 22
25 24
27 26
29 28
33 32
35 34
38 37
40 39
42 41
44 43
46 45
49 48
52 51
54 53
56 55
58 57
61 60
63 62
67 66
69 68
72 71
74 73
76 75
78 77
82 81
84 83
86 85
89 88
91 90
93 92
95 94
97 96
99 98
102 101
105 104
108 107
111 110
113 112
...

result:

ok Correct

Test #28:

score: 51
Accepted
time: 223ms
memory: 59304kb

input:

200000
69204 69206
193603 193601
20194 20200
191391 191385
154264 154261
14507 14505
90383 90387
172083 172079
133992 133994
127794 127788
129748 129750
97971 97964
20411 20408
192633 192635
118419 118416
54271 54237
118342 118344
178590 178592
96733 96722
139258 139260
124477 124480
182947 182949
1...

output:

1
200000
1 0
1 2
0 200000
4 3
6 5
9 8
12 11
16 15
18 17
20 19
23 22
26 25
29 28
34 33
36 35
38 37
40 39
44 43
46 45
49 48
51 50
53 52
56 55
58 57
61 60
64 63
68 67
70 69
72 71
74 73
77 76
79 78
82 81
86 85
89 88
92 91
97 96
99 98
101 100
103 102
107 106
109 108
111 110
113 112
115 114
117 116
120 11...

result:

ok Correct

Test #29:

score: 51
Accepted
time: 225ms
memory: 59532kb

input:

199999
175334 175340
151014 150988
85820 85818
25993 25991
65381 65364
96005 96000
188026 188029
159488 159495
173737 173745
134244 134239
194535 194530
35875 35877
135032 135028
16629 16626
43098 43100
141661 141657
8794 8787
55193 55187
134032 134040
156841 156803
132150 132154
191296 191294
11395...

output:

1
199999
1 0
1 2
0 199999
3 2
5 4
7 6
11 10
13 12
15 14
17 16
19 18
21 20
23 22
25 24
28 27
30 29
32 31
35 34
37 36
39 38
42 41
44 43
48 47
50 49
52 51
55 54
58 57
60 59
62 61
64 63
68 67
72 71
76 75
79 78
82 81
84 83
86 85
88 87
91 90
95 94
97 96
100 99
102 101
107 106
109 108
112 111
114 113
117 1...

result:

ok Correct

Test #30:

score: 51
Accepted
time: 209ms
memory: 59476kb

input:

200000
154316 154320
195097 195091
159303 159315
653 670
133115 133117
50780 50771
176812 176799
170325 170329
147474 147476
161457 161357
152918 152921
53180 53182
61494 61498
109879 109882
192877 192868
180082 180073
160773 160776
177937 177932
171755 171758
82073 82071
67015 67018
94341 94349
160...

output:

1
200000
3 2
3 4
2 200000
5 4
8 7
10 9
12 11
14 13
16 15
18 17
21 20
24 23
26 25
29 28
31 30
34 33
36 35
38 37
41 40
44 43
46 45
48 47
50 49
52 51
55 54
57 56
61 60
63 62
65 64
67 66
71 70
73 72
75 74
78 77
80 79
82 81
84 83
87 86
89 88
93 92
96 95
98 97
100 99
103 102
105 104
107 106
109 108
112 11...

result:

ok Correct

Test #31:

score: 51
Accepted
time: 210ms
memory: 59276kb

input:

200000
61205 59035
134943 85971
155541 155543
70425 13286
131522 90478
133818 86234
69737 16801
120355 120357
184202 184204
187218 187220
81125 159495
119271 119273
75115 190041
36848 36850
125938 118510
29537 67179
143390 143392
81604 157268
71548 7792
7731 71560
182489 182491
170093 170095
114803 ...

output:

1
200000
2 1
2 3
1 200000
4 3
7 6
11 10
13 12
15 14
18 17
21 20
23 22
27 26
30 29
33 32
36 35
38 37
40 39
42 41
44 43
47 46
49 48
51 50
53 52
57 56
59 58
61 60
63 62
65 64
67 66
69 68
72 71
74 73
77 76
79 78
81 80
83 82
87 86
91 90
93 92
99 98
101 100
103 102
107 106
110 109
112 111
114 113
117 116
...

result:

ok Correct

Test #32:

score: 51
Accepted
time: 232ms
memory: 59396kb

input:

200000
149553 149551
17197 17199
44043 44038
57183 126199
178475 178473
125348 67491
155985 155979
57811 57816
39232 127794
105499 105497
159105 159107
8759 8762
59210 59208
84920 84917
127416 43254
43860 43863
195158 195160
128683 28614
36458 128040
90080 90085
94951 94948
197460 131340
199997 2
12...

output:

1
200000
3 2
3 4
2 200000
7 6
10 9
15 14
17 16
19 18
25 24
27 26
29 28
31 30
33 32
36 35
40 39
43 42
46 45
49 48
51 50
53 52
55 54
60 59
64 63
66 65
68 67
71 70
73 72
77 76
82 81
84 83
86 85
88 87
91 90
94 93
96 95
98 97
100 99
103 102
106 105
113 112
115 114
119 118
122 121
124 123
129 128
134 133
...

result:

ok Correct

Test #33:

score: 51
Accepted
time: 224ms
memory: 59260kb

input:

200000
41376 41371
173694 173698
3480 3482
173700 172785
136148 131828
60880 60878
35323 35238
147152 147136
161020 161014
192345 192327
69956 69970
26407 26397
147394 147399
57179 57181
133883 133855
168707 168693
155362 155359
145336 145345
80693 77243
22445 22353
195732 195738
174451 174449
51231...

output:

1
200000
3 2
3 4
2 200000
5 4
9 8
14 13
17 16
20 19
23 22
25 24
29 28
33 32
36 35
38 37
40 39
43 42
45 44
47 46
50 49
52 51
55 54
57 56
64 63
70 69
73 72
80 79
83 82
85 84
88 87
90 89
92 91
94 93
96 95
99 98
101 100
103 102
107 106
110 109
112 111
114 113
118 117
120 119
123 122
125 124
128 127
131 ...

result:

ok Correct