QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#686845#8581. 섬SkyMaths100 ✓105ms26272kbC++201.5kb2024-10-29 16:00:532024-10-29 16:00:53

Judging History

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

  • [2024-10-29 16:00:53]
  • 评测
  • 测评结果:100
  • 用时:105ms
  • 内存:26272kb
  • [2024-10-29 16:00:53]
  • 提交

answer

#include<bits/stdc++.h>
#include "island.h"
#define rep(i,l,r) for (int i(l), i##end(r); i <= i##end; ++i)
#define per(i,r,l) for (int i(r), i##end(l); i >= i##end; --i)
#define LL long long
#define eb emplace_back
using namespace std;
#define edge array <int, 2>

const int Maxn = 2e5 + 9;
int n;
int deg[Maxn], vis[Maxn];
vector <edge> tree1, tree2;
vector <int> G[Maxn];

queue <int> que;
set <int> Sa;

void construct_two_trees(int N, std::vector<int> U, std::vector<int> V) {
    n = N;
    rep (i, 0, n - 4) {
        int u, v; u = U[i], v = V[i];
        G[u].eb(v), G[v].eb(u);
    }
    rep (u, 0, n - 1) {
        int v = u + 1; if (v == n) v = 0;
        G[u].eb(v), G[v].eb(u);
    }

    int a = 0, b = 1, c = -1; for (int v : G[a]) Sa.insert(v);
    for (int v : G[b]) if (Sa.find(v) != Sa.end()) c = v;

    int d = add_vertex(a, b, c);
    tree1 = {{a, d}, {d, c}, {c, b}};
    tree2 = {{c, a}, {a, b}, {b, d}};

    deg[a] = deg[b] = deg[c] = 2;
    que.push(a); que.push(b); que.push(c);
    while (!que.empty()) {
        int u = que.front(); que.pop();
        for (int v : G[u]) {
            ++deg[v];
            if (deg[v] == 2) {
                que.push(v);
                vector <int> vt;
                for (int w : G[v]) {
                    if (deg[w] >= 2) vt.eb(w);
                }
                assert(vt.size() == 2);
                tree1.eb(edge{v, vt[0]});
                tree2.eb(edge{v, vt[1]});
            }
        }
    }

    report(tree1);
    report(tree2);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 1ms
memory: 3824kb

input:

4
0 2

output:

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

result:

ok Correct

Test #2:

score: 6
Accepted
time: 1ms
memory: 4072kb

input:

3

output:

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

result:

ok Correct

Test #3:

score: 6
Accepted
time: 1ms
memory: 3816kb

input:

4
3 1

output:

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

result:

ok Correct

Test #4:

score: 6
Accepted
time: 1ms
memory: 3896kb

input:

5
1 4
1 3

output:

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

result:

ok Correct

Subtask #2:

score: 8
Accepted

Test #5:

score: 8
Accepted
time: 1ms
memory: 3820kb

input:

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

output:

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

result:

ok Correct

Test #6:

score: 8
Accepted
time: 1ms
memory: 3964kb

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
0 1000
1000 10
10 1
999 10
2 10
998 10
3 10
997 10
4 10
996 10
5 10
995 10
6 10
994 10
7 10
993 10
8 10
992 10
9 8
991 10
990 10
989 10
988 10
987 10
986 10
985 10
984 10
983 10
982 10
981 10
980 10
979 10
978 10
977 10
976 10
975 10
974 10
973 10
972 10
971 10
970 10
969 10
968 10
967 10
966...

result:

ok Correct

Test #7:

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

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
0 5000
5000 3653
3653 1
4999 3653
2 3653
4998 3653
3 3653
4997 3653
4 3653
4996 3653
5 3653
4995 3653
6 3653
4994 3653
7 3653
4993 3653
8 3653
4992 3653
9 3653
4991 3653
10 3653
4990 3653
11 3653
4989 3653
12 3653
4988 3653
13 3653
4987 3653
14 3653
4986 3653
15 3653
4985 3653
16 3653
4984 36...

result:

ok Correct

Test #8:

score: 8
Accepted
time: 94ms
memory: 25896kb

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
0 199999
199999 98281
98281 1
199998 98281
2 98281
199997 98281
3 98281
199996 98281
4 98281
199995 98281
5 98281
199994 98281
6 98281
199993 98281
7 98281
199992 98281
8 98281
199991 98281
9 98281
199990 98281
10 98281
199989 98281
11 98281
199988 98281
12 98281
199987 98281
13 98281
19998...

result:

ok Correct

Test #9:

score: 8
Accepted
time: 73ms
memory: 25916kb

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
0 200000
200000 175608
175608 1
2 175608
199999 175608
3 175608
199998 175608
4 175608
199997 175608
5 175608
199996 175608
6 175608
199995 175608
7 175608
199994 175608
8 175608
199993 175608
9 175608
199992 175608
10 175608
199991 175608
11 175608
199990 175608
12 175608
199989 175608
13 ...

result:

ok Correct

Subtask #3:

score: 14
Accepted

Test #10:

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

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
0 5000
5000 4593
4593 1
4999 4593
2 4593
4998 4593
3 4593
4997 4593
4 4593
4996 4593
5 4593
4995 4593
6 4593
4994 4593
7 4593
4993 4593
8 4593
4992 4593
9 4593
4991 4593
10 4593
4990 4593
11 4593
4989 4593
12 4593
4988 4593
13 4593
4987 4593
14 4593
4986 4593
15 4593
4985 4593
16 4593
4984 45...

result:

ok Correct

Test #11:

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

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
0 5000
5000 2601
2601 1
4999 2601
2 2601
4998 2601
3 2601
4997 2601
4 2601
4996 2601
5 2601
4995 2601
6 2601
4994 2601
7 2601
4993 2601
8 2601
4992 2601
9 2601
4991 2601
10 2601
4990 2601
11 2601
4989 2601
12 2601
4988 2601
13 2601
4987 2601
14 2601
4986 2601
15 2601
4985 2601
16 2601
4984 26...

result:

ok Correct

Test #12:

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

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
0 5000
5000 4235
4235 1
2 4235
4999 4235
3 4235
4998 4235
4 4235
4997 4235
5 4235
4996 4235
6 4235
4995 4235
7 4235
4994 4235
8 4235
4993 4235
9 4235
4992 4235
10 4235
4991 4235
11 4235
4990 4235
12 4235
4989 4235
13 4235
4988 4235
14 4235
4987 4235
15 4235
4986 4235
16 4235
4985 4235
17 4235...

result:

ok Correct

Test #13:

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

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
0 5000
5000 1194
1194 1
4999 1194
2 1194
1195 4999
3 1194
4998 1195
4 1194
4997 1195
1193 4
4996 1195
5 1193
4995 1195
1192 5
4994 1195
1191 5
4993 1195
1190 5
4992 1195
1189 5
1196 4992
6 1189
1197 4992
1188 6
4991 1197
7 1188
1198 4991
8 1188
4990 1198
1187 8
1199 4990
9 1187
4989 1199
10 1...

result:

ok Correct

Test #14:

score: 14
Accepted
time: 88ms
memory: 25372kb

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
0 200000
200000 118877
118877 1
199999 118877
2 118877
199998 118877
3 118877
199997 118877
4 118877
199996 118877
5 118877
199995 118877
6 118877
199994 118877
7 118877
199993 118877
8 118877
199992 118877
9 118877
199991 118877
10 118877
199990 118877
11 118877
199989 118877
12 118877
199...

result:

ok Correct

Test #15:

score: 14
Accepted
time: 89ms
memory: 24896kb

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
0 200000
200000 168647
168647 1
2 168647
199999 168647
3 168647
199998 168647
4 168647
199997 168647
5 168647
199996 168647
6 168647
199995 168647
7 168647
199994 168647
8 168647
199993 168647
9 168647
199992 168647
10 168647
199991 168647
11 168647
199990 168647
12 168647
199989 168647
13 ...

result:

ok Correct

Test #16:

score: 14
Accepted
time: 76ms
memory: 25484kb

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
0 200000
200000 53673
53673 1
2 53673
199999 53673
3 53673
199998 53673
4 53673
199997 53673
5 53673
199996 53673
6 53673
199995 53673
7 53673
199994 53673
8 53673
199993 53673
9 53673
199992 53673
10 53673
199991 53673
11 53673
199990 53673
12 53673
199989 53673
13 53673
199988 53673
14 53...

result:

ok Correct

Test #17:

score: 14
Accepted
time: 102ms
memory: 26272kb

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
0 200000
200000 80817
80817 1
199999 80817
80816 1
199998 80817
80815 1
80818 199998
2 80815
199997 80818
3 80815
80819 199997
4 80815
199996 80819
5 80815
199995 80819
80814 5
80820 199995
80813 5
80821 199995
6 80813
199994 80821
7 80813
199993 80821
8 80813
199992 80821
80812 8
199991 80...

result:

ok Correct

Test #18:

score: 14
Accepted
time: 80ms
memory: 23848kb

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
0 200000
200000 185805
185805 1
185804 1
185806 0
2 185804
199999 185806
185803 2
185807 199999
3 185803
199998 185807
185802 3
185808 199998
4 185802
199997 185808
185801 4
185809 199997
5 185801
199996 185809
185800 5
185810 199996
6 185800
199995 185810
185799 6
185811 199995
7 185799
19...

result:

ok Correct

Subtask #4:

score: 21
Accepted

Dependency #1:

100%
Accepted

Test #19:

score: 21
Accepted
time: 1ms
memory: 3820kb

input:

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

output:

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

result:

ok Correct

Test #20:

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

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
0 4999
4999 2
2 1
4998 2
4 4998
4986 4998
3 2
4876 4
4995 4986
55 4
4906 4986
4997 4995
4993 4986
39 55
4727 55
4919 4906
4902 4906
4996 4995
4991 4993
4994 4993
43 39
31 4
3567 4727
4858 4876
4910 4906
4983 4986
4905 4902
4895 4902
4988 4986
4992 4991
51 43
41 43
35 31
17 31
3934 4727
3009 5...

result:

ok Correct

Test #21:

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

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 5000
5000 4999
4999 1
3 4999
10 3
2 1
22 4999
9 3
34 4999
13 10
7 9
25 34
4992 34
11 13
14 22
5 3
8 7
31 34
23 25
58 34
4993 4999
12 11
21 14
4 3
6 5
27 25
33 31
24 23
40 58
4989 58
4995 4999
19 14
26 25
28 31
32 31
46 58
36 34
4868 4989
4991 4989
4997 4999
4994 4993
16 19
20 19
30 28
51 46...

result:

ok Correct

Test #22:

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

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
0 4999
4999 2
2 1
4994 0
4997 4994
4993 2
4995 4997
4998 4997
4977 4993
4996 4995
4990 4977
7 2
4986 4990
4991 4993
4958 4977
4 2
4981 4986
4987 4990
4992 4991
31 4958
4970 4977
3 2
5 7
4984 4981
4978 4981
4988 4990
8 31
4910 4958
4965 4970
4973 4977
6 5
4982 4984
4985 4984
4979 4981
4989 498...

result:

ok Correct

Test #23:

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

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
0 5000
5000 2
2 1
4 0
7 4
3 2
5 7
4983 0
6 5
4998 0
11 7
4996 4983
4999 4998
4974 4983
9 7
4984 4996
4997 4996
19 4974
4981 4983
8 7
10 9
4986 4984
24 19
17 11
4976 4974
4982 4981
4993 4996
4985 4984
33 24
21 19
13 17
18 17
4978 4981
4975 4974
4991 4986
4994 4996
634 4974
26 33
20 19
22 24
12...

result:

ok Correct

Test #24:

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

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 5000
5000 4999
4999 1
916 1
4997 4999
3 1
4995 916
4998 4997
2 1
4 916
4993 4995
4996 4995
915 4
4992 916
4994 4993
914 4
4990 4992
6 4
4988 916
4991 4990
5 4
7 914
917 4988
4989 4988
9 914
918 4988
913 9
8 7
919 4988
11 913
920 4988
10 9
12 913
921 4988
14 12
4986 4988
16 14
13 12
4984 498...

result:

ok Correct

Test #25:

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

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
0 5000
5000 4997
4997 1
3 1
4998 0
4995 3
2 1
4999 4998
473 4995
4996 4995
4994 473
4 473
4993 473
5 473
474 4993
20 473
4951 4993
22 473
19 5
4954 4951
4950 474
25 22
21 20
6 19
4953 4951
4955 4993
4949 474
472 25
24 22
8 19
4952 4951
4966 4993
4947 4949
34 472
23 22
11 8
7 6
4964 4966
4970 ...

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: 18ms
memory: 7124kb

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 36116
36116 36115
36115 1
3 36115
36114 3
2 1
36113 3
36107 36113
36112 36107
4 36107
36108 36112
36105 36107
36110 36112
5 36105
36106 36105
36109 36108
36111 36110
36104 5
22 36104
36103 22
21 5
26 22
17 5
24 26
36097 26
19 21
11 5
23 22
25 24
36099 36097
36096 26
18 17
20 19
7 5
12 17
3...

result:

ok Correct

Test #27:

score: 51
Accepted
time: 89ms
memory: 25952kb

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
0 199999
199999 2
2 1
199998 2
4 199998
199972 4
3 2
199952 199972
199988 199998
199967 199952
199922 4
199982 199988
199990 199988
199969 199967
199963 199952
199813 4
199949 199952
199980 199972
199985 199982
199993 199998
199989 199988
199971 199969
199968 199967
199965 199963
199953 199...

result:

ok Correct

Test #28:

score: 51
Accepted
time: 100ms
memory: 25488kb

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
0 200000
200000 2
2 1
199999 2
199995 2
199997 199995
199991 199995
199996 199995
199998 199997
199989 199991
199992 199995
5 199989
199990 199989
199994 199992
199903 199989
3 5
199993 199992
199901 199903
199968 199989
4 3
199869 5
199902 199901
199916 199968
199972 199989
199885 199901
1...

result:

ok Correct

Test #29:

score: 51
Accepted
time: 105ms
memory: 25128kb

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
0 199999
199999 2
2 1
4 0
199998 4
3 2
199991 199998
199994 199991
14 199991
199992 199994
199995 199998
18 14
12 14
199993 199992
199996 199998
16 14
199939 18
8 12
13 12
199997 199996
15 14
17 16
199908 199939
199983 199991
6 8
9 12
20 18
199929 199939
199987 199983
199943 199939
5 4
7 6
...

result:

ok Correct

Test #30:

score: 51
Accepted
time: 103ms
memory: 25336kb

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
0 200000
200000 199998
199998 1
2 199998
199999 199998
4 2
28 4
3 2
199989 199998
15 4
352 199989
199995 199998
23 15
11 4
514 199989
174 352
199991 199989
199997 199995
25 23
20 23
13 11
7 11
368 514
199510 514
239 174
115 174
199993 199991
199990 199989
199996 199995
27 25
24 23
22 20
19 ...

result:

ok Correct

Test #31:

score: 51
Accepted
time: 97ms
memory: 25516kb

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
0 200000
200000 73163
73163 1
3 1
73164 0
5 73163
2 1
199999 73164
73162 5
4 3
73165 199999
6 73162
199997 73165
8 73162
199995 199997
199998 199997
73161 8
7 6
199993 199995
199996 199995
9 73161
199991 199993
199994 199993
10 73161
73166 199991
199992 199991
12 10
199989 199991
14 73161
1...

result:

ok Correct

Test #32:

score: 51
Accepted
time: 101ms
memory: 25696kb

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
0 200000
200000 199998
199998 1
2 199998
199999 199998
199997 2
4 199997
199996 4
3 2
5 199996
199995 5
6 199995
8 6
131130 8
7 6
9 131130
131131 199995
12 131130
199992 131131
11 9
13 131130
131132 199992
199993 199995
10 9
16 131130
199991 131132
199994 199993
14 16
131129 16
199989 19999...

result:

ok Correct

Test #33:

score: 51
Accepted
time: 103ms
memory: 25952kb

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
0 200000
200000 199172
199172 1
199999 199172
11 199172
199990 199172
2 11
12 199172
199174 199172
199997 199999
10 2
199157 12
199188 199990
199173 199172
199992 199990
199998 199997
4 10
199171 199157
15 12
199186 199174
199980 199188
199994 199992
199991 199990
6 10
3 2
199158 199171
13 ...

result:

ok Correct