QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#645494#6388. Networkhzlqwq100 ✓139ms61176kbC++171.5kb2024-10-16 18:42:572024-10-16 18:42:59

Judging History

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

  • [2024-10-16 18:42:59]
  • 评测
  • 测评结果:100
  • 用时:139ms
  • 内存:61176kb
  • [2024-10-16 18:42:57]
  • 提交

answer

#include <iostream>
#include <vector>
#define PII pair<int, int>

using namespace std;

const int N = 2e5 + 5;

int n, m, a[N], b[N], fa[N], lca[N], sz[N], dfn[N], col[N];
vector<int> e[N], qry[N], ans;
vector<PII> ql[N];

int find(int x)
{
    return x ^ fa[x] ? fa[x] = find(fa[x]) : x;
}

void dfs(int u, int f)
{
    sz[u] = 1, dfn[u] = ++dfn[0];
    for (auto [v, id] : ql[u])
        if (dfn[v])
            lca[id] = find(v);
    for (auto j : e[u])
        if (j ^ f)
            dfs(j, u), sz[u] += sz[j];
    fa[u] = find(f);
}

void cover(int l, int r)
{
    l = find(l);
    while (l <= r)
        col[l] = 1, fa[l] = find(l + 1), l = fa[l];
}

void work(int u, int f)
{
    for (auto j : e[u])
        if (j ^ f)
            work(j, u);
    for (auto id : qry[u])
        if (!col[dfn[a[id]]] && !col[dfn[b[id]]])
            ans.push_back(u), cover(dfn[u], dfn[u] + sz[u] - 1);
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> n >> m;
    for (int i = 1, u, v; i < n; i++)
        cin >> u >> v, e[u].push_back(v), e[v].push_back(u);
    for (int i = 1; i <= m; i++)
        cin >> a[i] >> b[i], ql[a[i]].push_back({b[i], i}), ql[b[i]].push_back({a[i], i});
    for (int i = 1; i <= n; i++)
        fa[i] = i;
    dfs(1, 0);
    for (int i = 1; i <= m; i++)
        qry[lca[i]].push_back(i);
    for (int i = 1; i <= n + 1; i++)
        fa[i] = i;
    work(1, 0);
    cout << ans.size() << "\n";
    for (auto u : ans)
        cout << u << " ";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 85ms
memory: 61176kb

input:

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

output:

200000
200000 199999 199998 199997 199996 199995 199994 199993 199992 199991 199990 199989 199988 199987 199986 199985 199984 199983 199982 199981 199980 199979 199978 199977 199976 199975 199974 199973 199972 199971 199970 199969 199968 199967 199966 199965 199964 199963 199962 199961 199960 199959...

result:

ok correct plan

Test #2:

score: 4
Accepted
time: 50ms
memory: 33760kb

input:

192791 177013
15163 96594
16414 102268
89243 170228
57950 132600
162574 32273
2947 78186
41636 62390
73315 15163
159645 21314
185962 122448
75023 149485
145294 145941
154151 174468
11494 16133
14507 183387
92177 141072
71628 187859
123587 177507
55726 185406
170316 48341
28477 167274
76200 94096
717...

output:

113
157761 166653 162621 192732 169220 161320 186027 188963 169741 185143 161250 160688 162094 185278 183355 186804 186400 163370 175503 166310 167302 160832 175184 178023 181355 178226 170623 172742 158640 186904 183049 186889 159880 171527 164604 189994 169117 173599 177480 170980 164012 165670 18...

result:

ok correct plan

Test #3:

score: 4
Accepted
time: 87ms
memory: 56304kb

input:

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

output:

122449
193083 193082 193079 193078 193075 193074 193073 193072 193071 193067 193066 193065 193064 193063 193060 193059 193057 193053 193052 193051 193048 193047 193043 193042 193040 193038 193037 193036 193035 193034 193033 193032 193026 193025 193024 193023 193022 193020 193018 193017 193016 193014...

result:

ok correct plan

Test #4:

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

input:

1 15
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:

1
1 

result:

ok correct plan

Test #5:

score: 4
Accepted
time: 3ms
memory: 20420kb

input:

15 15
12 4
7 15
10 15
13 14
2 10
10 3
12 5
6 13
15 13
14 1
9 3
2 8
13 12
9 11
1 1
9 9
1 1
8 8
7 7
8 8
14 14
7 7
1 1
1 1
13 13
11 11
7 7
13 13
11 11

output:

7
7 8 11 9 13 14 1 

result:

ok correct plan

Test #6:

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

input:

2000 2000
646 1544
259 1127
1827 903
859 292
1520 1908
478 1986
1471 1556
1829 894
32 1676
876 1610
234 1082
36 1554
408 1056
1910 931
290 1091
1246 1491
280 1923
1244 1084
843 1940
227 756
961 733
856 255
1496 1750
1951 961
758 816
319 1413
302 1932
122 11
1853 53
113 1600
1391 1654
1995 1680
1626 ...

output:

1251
1162 108 1115 1235 1673 923 1683 661 1507 275 703 750 613 1070 298 1240 172 324 1775 1469 1781 948 1357 211 1384 1180 626 44 180 173 191 549 1510 571 582 203 1071 309 789 1331 66 1161 1447 1003 912 408 1996 1695 304 1210 1241 1011 846 1493 154 1531 882 839 325 539 1001 346 1616 1881 501 675 107...

result:

ok correct plan

Test #7:

score: 4
Accepted
time: 117ms
memory: 38408kb

input:

198912 186079
95780 144147
156043 6576
73725 177413
193666 6531
3185 35106
50448 92669
57454 69007
125547 119658
48130 110361
134981 69883
112070 85977
55781 101462
142588 148493
22305 45089
54391 189769
82051 53939
76255 10560
143560 197809
117454 69061
134035 101491
23080 88239
132686 178401
59762...

output:

120929
91053 135587 134802 114493 74207 93284 154631 170275 46661 111880 42948 114304 38717 188973 163628 187155 195590 121496 42080 142474 152948 119203 118818 151805 146103 11086 13503 153734 37135 97381 62602 8216 87163 186335 144367 175360 91466 58515 27436 168993 125954 95874 31805 38042 4152 1...

result:

ok correct plan

Subtask #2:

score: 17
Accepted

Test #8:

score: 17
Accepted
time: 67ms
memory: 60808kb

input:

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

output:

100001
200000 199998 199996 199994 199992 199990 199988 199986 199984 199982 199980 199978 199976 199974 199972 199970 199968 199966 199964 199962 199960 199958 199956 199954 199952 199950 199948 199946 199944 199942 199940 199938 199936 199934 199932 199930 199928 199926 199924 199922 199920 199918...

result:

ok correct plan

Test #9:

score: 17
Accepted
time: 101ms
memory: 58556kb

input:

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

output:

502
199736 199187 199019 198812 198385 197865 197488 197434 196996 196548 195822 195297 194817 194425 194258 193854 193520 192880 192565 191928 191422 191006 190810 190632 190353 190170 189718 189184 188540 188102 187821 187626 187037 186379 186023 185915 185453 184741 184641 184033 183782 183605 18...

result:

ok correct plan

Test #10:

score: 17
Accepted
time: 95ms
memory: 55992kb

input:

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

output:

5417
199976 199959 199936 199923 199911 199897 199886 199873 199862 199850 199835 199828 199817 199811 199802 199788 199776 199769 199746 199732 199719 199711 199702 199683 199682 199667 199648 199629 199613 199598 199582 199572 199564 199549 199527 199522 199517 199515 199501 199486 199478 199463 1...

result:

ok correct plan

Test #11:

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

input:

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

output:

45
1995 1959 1903 1861 1830 1809 1772 1709 1619 1593 1569 1538 1509 1463 1397 1346 1290 1206 1152 1064 1035 1020 995 958 933 859 803 749 679 654 636 584 552 477 401 349 284 188 180 159 152 98 71 47 5 

result:

ok correct plan

Test #12:

score: 17
Accepted
time: 59ms
memory: 53788kb

input:

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

output:

1
14123 

result:

ok correct plan

Test #13:

score: 17
Accepted
time: 92ms
memory: 55972kb

input:

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

output:

4
145045 107588 78878 34415 

result:

ok correct plan

Test #14:

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

input:

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

output:

1
1 

result:

ok correct plan

Subtask #3:

score: 14
Accepted

Test #15:

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

input:

5 15
5 4
3 4
5 1
5 2
4 4
1 4
2 2
4 2
5 2
1 3
1 2
3 1
3 5
2 4
2 2
1 4
3 4
5 4
3 4

output:

2
4 2 

result:

ok correct plan

Test #16:

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

input:

15 15
3 7
12 15
4 11
12 14
8 3
9 13
10 12
3 2
5 6
8 13
5 10
1 8
11 2
15 1
5 5
13 13
9 13
14 12
9 9
6 5
6 6
13 13
5 6
15 1
9 13
10 10
15 1
10 10
13 9

output:

7
9 13 6 5 10 12 1 

result:

ok correct plan

Test #17:

score: 14
Accepted
time: 4ms
memory: 19888kb

input:

15 15
9 8
14 5
13 12
9 1
3 5
1 15
2 3
6 7
5 8
9 13
7 8
5 4
3 11
10 3
8 5
13 5
12 6
1 13
15 2
13 6
13 6
10 5
7 12
2 7
8 9
8 1
14 6
7 6
13 15

output:

3
5 7 9 

result:

ok correct plan

Subtask #4:

score: 29
Accepted

Dependency #3:

100%
Accepted

Test #18:

score: 29
Accepted
time: 3ms
memory: 19880kb

input:

40 2000
24 18
24 23
38 26
26 13
4 8
9 35
7 17
23 22
25 40
34 28
6 3
32 16
17 16
27 33
3 40
22 16
2 23
31 18
40 35
11 12
29 16
30 12
35 12
18 26
15 6
28 1
26 36
3 5
23 19
33 10
33 23
39 28
22 8
19 21
37 19
23 12
20 14
28 27
14 28
16 24
15 1
6 16
34 30
16 24
2 32
8 12
35 33
37 25
37 28
30 32
36 35
36 ...

output:

29
10 38 36 26 18 24 32 17 16 4 22 2 21 37 19 11 30 9 15 6 5 40 35 23 33 27 14 28 1 

result:

ok correct plan

Test #19:

score: 29
Accepted
time: 0ms
memory: 22940kb

input:

2000 40
324 734
227 1309
485 1789
300 1206
1035 1390
1789 62
576 629
1997 1787
668 848
1075 1768
1920 1601
876 1223
619 309
557 870
1381 394
1202 1857
786 1851
1614 938
1142 1779
489 1652
927 1035
800 1424
494 176
1643 576
1130 1970
36 1148
1076 656
1229 284
990 427
1229 1774
422 602
1467 1528
408 1...

output:

6
1570 1923 909 1761 1911 104 

result:

ok correct plan

Test #20:

score: 29
Accepted
time: 0ms
memory: 23188kb

input:

1999 1998
921 63
1320 19
754 1091
454 1602
840 679
1713 852
1959 984
250 1751
1407 949
1949 208
1884 1560
703 636
1628 582
1736 1810
1998 955
1041 840
1591 1776
1032 1877
1319 1178
360 583
691 129
1510 1799
440 1807
307 939
976 880
1326 81
1386 1782
69 477
1234 1896
999 322
1136 931
1507 1780
1916 2...

output:

378
1105 407 125 1992 40 648 1281 79 1346 1710 916 1073 1317 1944 1013 412 1169 1727 991 592 124 146 42 701 1686 430 1219 1025 1789 804 485 656 714 1402 1446 117 1029 382 1858 1066 246 587 627 1300 352 978 329 1266 876 1284 1223 1253 892 1564 1695 951 1560 990 946 1552 374 1631 1069 880 132 448 708 ...

result:

ok correct plan

Test #21:

score: 29
Accepted
time: 0ms
memory: 21268kb

input:

2000 2000
1242 38
3 1172
1653 105
616 917
721 704
563 53
1643 1708
1743 1969
638 763
1603 1855
624 55
616 707
471 1725
233 838
691 1691
82 1799
902 1396
1741 1071
870 1979
100 1113
883 1612
738 533
372 1132
1467 1259
1953 994
1286 1980
156 796
1319 976
1481 213
506 1748
1908 7
1440 1655
927 498
1254...

output:

29
1763 1106 723 1220 1531 1529 1822 948 1481 1378 1864 1492 1156 595 1866 1114 583 1252 1408 1565 1203 1564 1229 984 1431 1104 1418 1197 935 

result:

ok correct plan

Test #22:

score: 29
Accepted
time: 5ms
memory: 22952kb

input:

2000 2000
1100 1952
822 756
1211 1245
1457 33
554 224
894 1548
1909 1991
365 1489
428 1489
1952 1746
1289 1280
206 1503
1109 375
881 1205
1812 769
431 1597
127 873
242 1570
1952 1735
931 1356
245 1969
1345 873
1138 57
1994 122
1628 1243
1503 1414
743 756
756 431
756 1447
1883 1993
1217 1952
1969 105...

output:

17
1343 57 1113 637 1503 1952 455 1969 1152 224 873 1941 520 1489 1871 1280 756 

result:

ok correct plan

Test #23:

score: 29
Accepted
time: 4ms
memory: 23028kb

input:

1922 1993
913 460
1350 1848
1551 225
1692 301
1415 885
1751 254
1257 425
323 475
665 783
612 763
272 1016
747 480
715 1550
321 1609
1111 1669
1003 1413
881 1742
331 1829
519 1087
1080 668
900 1846
1386 1760
1352 183
1148 481
1156 1683
662 1861
188 716
1643 1425
1433 1029
1834 1195
1070 254
1590 454
...

output:

40
1570 1583 301 1700 1825 300 639 1395 319 937 1812 695 1109 1739 1902 850 288 1912 357 810 650 928 297 598 523 1122 1602 1345 511 1018 1664 446 1652 157 1016 1718 1154 65 507 1441 

result:

ok correct plan

Test #24:

score: 29
Accepted
time: 2ms
memory: 21672kb

input:

150 2000
119 133
136 119
86 119
119 34
119 100
119 13
76 119
119 65
119 71
119 130
119 66
143 119
119 150
119 115
119 9
119 25
64 119
119 73
74 119
40 119
119 82
119 35
119 110
111 119
119 132
119 20
50 119
87 119
119 120
119 6
7 119
119 90
92 119
126 119
32 119
119 29
119 144
96 119
119 42
8 119
11...

output:

12
76 65 73 42 141 54 118 131 28 91 15 119 

result:

ok correct plan

Subtask #5:

score: 36
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #25:

score: 36
Accepted
time: 16ms
memory: 26368kb

input:

1000 200000
962 786
10 602
689 122
331 609
456 224
682 555
258 809
340 387
460 90
850 387
305 977
139 820
73 439
783 713
855 235
302 3
271 474
468 946
93 308
819 976
69 548
790 83
25 642
506 841
39 853
665 520
186 952
282 704
192 544
206 756
903 458
207 461
222 293
305 620
167 473
218 838
436 963
33...

output:

365
943 409 525 179 472 222 382 246 960 805 692 830 419 273 988 31 781 533 877 451 558 295 22 659 807 833 375 216 505 947 780 340 302 850 166 524 895 786 387 178 967 213 358 637 478 686 560 678 973 11 281 735 120 78 44 576 141 839 992 685 149 949 506 336 668 842 266 726 644 860 126 667 608 255 209 5...

result:

ok correct plan

Test #26:

score: 36
Accepted
time: 61ms
memory: 28444kb

input:

200000 1000
95107 88168
164771 85445
66359 162412
163788 180604
34366 91353
106881 49515
160504 82649
164411 27137
8466 118113
76696 110444
183716 55642
183361 57033
35294 82872
72862 71258
142773 21106
143580 42596
110137 165652
146176 170264
198469 142707
69183 43753
38091 114103
184519 46414
3837...

output:

35
6870 106804 83571 8208 15485 136181 97190 47353 118099 128781 54009 55215 39248 140609 138039 108306 24248 162238 94292 87736 30322 113563 157460 118112 185863 123748 185421 46465 85967 93930 159029 164459 19204 105664 1 

result:

ok correct plan

Test #27:

score: 36
Accepted
time: 109ms
memory: 36300kb

input:

185187 190124
129481 181690
140662 95760
169227 45363
139452 85447
33367 61989
11211 71033
184146 43438
177997 67240
112457 114889
169331 31429
157559 26171
30228 104581
72925 124203
60734 119134
182866 88147
159343 61451
142062 70863
160999 80006
132410 61922
184613 135766
88844 13399
28172 171484
...

output:

368
70224 103805 157006 114348 101075 54836 110848 66046 48984 9946 50799 60228 13228 99702 48198 118353 22409 160733 73875 165417 100286 109763 96971 113729 129601 139977 104942 3463 40682 69700 46006 60587 143453 80661 60149 43536 136138 141369 13097 132166 134262 59583 11227 62352 91966 60430 295...

result:

ok correct plan

Test #28:

score: 36
Accepted
time: 89ms
memory: 36684kb

input:

199023 194992
112150 381
61419 62872
61493 109624
197795 111364
137979 61211
1807 100136
98752 183589
27951 9284
5836 93144
78987 24773
17566 123497
44908 183698
119459 186104
145308 130621
157247 189676
18511 169097
7633 180862
87954 29481
155086 118436
61203 62285
53853 31684
162988 46237
153023 1...

output:

15303
43566 113409 126917 38170 176177 6612 103343 13345 111672 5172 151158 45640 192223 108129 58799 177464 39380 195866 180481 102352 182044 57552 170130 79448 119392 193827 171789 55464 6848 15934 70615 11150 43920 31407 192559 68295 104772 129292 49535 18030 40051 4796 6811 159358 107876 48296 1...

result:

ok correct plan

Test #29:

score: 36
Accepted
time: 126ms
memory: 37076kb

input:

199675 197898
16067 23538
35080 107246
156465 86388
58637 139661
18908 67140
157193 188391
177753 80905
33730 68936
14860 156486
182042 62689
78274 133213
65374 179074
159979 180325
1191 11882
177049 5310
142145 148996
180278 105063
164908 46889
35330 25704
167829 77893
107073 87455
118234 84839
122...

output:

485
129832 77413 38775 110099 75174 109098 160574 1466 171466 88607 25644 128144 34375 153005 35298 152065 115566 18620 45724 137301 74028 196854 76556 181986 26805 48739 82247 116827 107931 147989 177451 13096 167610 28822 154845 2006 78610 172955 190318 156556 47249 126675 161370 151365 176295 152...

result:

ok correct plan

Test #30:

score: 36
Accepted
time: 72ms
memory: 32976kb

input:

188144 189189
113457 126804
172368 902
135979 124925
52117 30447
50855 151736
10826 79905
112635 160398
36405 76006
115641 49725
118723 160596
36598 64055
56276 6591
106106 50501
55734 13740
84294 46053
2132 106130
38498 127898
47536 23430
109961 129969
111107 28576
142369 142132
148458 108051
14537...

output:

109
165585 169260 154799 136812 185394 167888 120114 122591 133668 152823 177234 136234 127610 128191 157520 128778 170536 165890 164578 154893 150471 157213 141355 119876 186616 114898 174584 127355 144355 169661 161281 132666 155389 142230 150926 129954 185305 140303 160140 143446 185266 130628 14...

result:

ok correct plan

Test #31:

score: 36
Accepted
time: 98ms
memory: 38420kb

input:

197567 197283
76986 5176
162491 82631
153709 153234
122448 119015
46542 134867
144078 36712
87847 56340
55550 152283
131639 157934
69114 80854
95441 107667
87709 108324
194073 78052
23351 173199
92762 23785
107493 145155
36686 114909
95441 26463
23558 418
24192 95441
188076 182221
122910 196908
8147...

output:

181
181252 5257 90098 6823 24357 37082 2456 16614 10589 10069 96607 129365 140920 194086 140895 132475 144078 3619 43773 146144 27385 91311 76438 63933 86999 29183 160883 184217 193623 193080 103325 128619 102026 23640 196388 130009 134867 133175 150299 141571 55551 142227 39185 82631 194409 418 243...

result:

ok correct plan

Test #32:

score: 36
Accepted
time: 122ms
memory: 37736kb

input:

199999 199998
57299 111055
31703 48204
138530 64729
4600 166389
182536 187355
100197 82429
35502 24171
35688 91780
44623 157178
7241 184089
140355 193065
13714 166126
11578 184978
12311 58219
21287 118071
166322 177326
88842 196118
139280 79683
145174 41137
32309 4491
145206 58270
132044 47673
34482...

output:

499
73101 188815 113466 154589 81319 19295 53271 68152 10381 75013 188204 93978 69998 32099 52202 43788 129139 120390 160595 46032 102775 24466 80397 60026 41048 183026 177505 32959 85807 65274 131555 17139 3726 142270 117329 97226 119495 158896 83320 169602 84567 143386 476 25088 156599 828 166321 ...

result:

ok correct plan

Test #33:

score: 36
Accepted
time: 86ms
memory: 38000kb

input:

200000 200000
135271 36583
109466 135271
40256 135271
135271 111522
141759 135271
188471 135271
133818 135271
135271 88349
115520 135271
96459 135271
117693 135271
135271 99209
135271 75826
135271 167880
135271 99672
135271 176594
183481 135271
77190 135271
197698 135271
193882 135271
135271 154656
...

output:

1
135271 

result:

ok correct plan

Test #34:

score: 36
Accepted
time: 132ms
memory: 50612kb

input:

200000 200000
76496 153200
107795 113185
159406 16131
127262 90537
43113 182602
170954 168070
83387 3383
15385 116831
191157 42268
142379 72960
156347 53592
163269 159122
29345 40574
61150 40382
65207 22984
94675 160869
26519 154814
10651 22764
60852 114858
191065 166952
47089 70874
128594 115795
18...

output:

492
118272 93885 108798 56845 178685 132683 191525 129915 3712 161615 4847 172608 181169 86836 129202 116830 101663 116157 181494 18194 119965 31580 194373 71410 34633 35604 180141 103833 167813 139448 96996 180355 52572 174397 73781 21370 150870 23426 37370 166896 50466 168520 72222 67212 129489 28...

result:

ok correct plan

Test #35:

score: 36
Accepted
time: 116ms
memory: 36876kb

input:

200000 200000
14980 136780
44323 79762
56355 132044
158375 82833
189773 80348
14529 178342
62749 130697
61919 36105
186627 167479
136960 128736
73870 123049
1448 25238
46365 167002
123272 150814
62234 145472
9864 176429
127389 42159
41705 13715
112747 158444
136311 138613
168668 49610
43693 143003
7...

output:

461
175036 82532 159584 82118 192079 115761 147996 155494 40032 147835 145765 13833 65806 177534 98263 81189 47112 183700 34010 93644 99560 167187 158101 61340 98695 15846 83067 149065 26657 9895 65426 135788 19821 17597 80698 79644 35413 196135 164180 147416 136160 4603 34737 174087 195433 42775 15...

result:

ok correct plan

Test #36:

score: 36
Accepted
time: 139ms
memory: 47568kb

input:

200000 200000
91610 157149
169751 144801
164986 81171
89525 134455
30949 57500
184578 30443
84434 27008
89793 156988
199474 182061
33191 99697
86720 164130
83125 1073
42970 184483
1335 1032
154225 25386
130159 123083
129354 99811
50757 82711
90620 89351
53688 31659
42135 146681
29266 7620
31387 5316...

output:

5
7717 60638 76505 145436 1 

result:

ok correct plan

Test #37:

score: 36
Accepted
time: 106ms
memory: 52884kb

input:

199999 199999
1 2
2 3
3 4
3 184691
3 187429
4 5
5 6
6 7
7 8
8 9
8 190964
9 10
10 11
11 12
12 13
13 14
14 15
15 16
15 169232
15 175253
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
23 192679
24 25
25 26
25 163741
26 27
27 28
28 29
29 30
29 170209
30 31
31 32
31 178883
32 33
33 34
34 35
35 36
36 37
...

output:

220
159205 158356 157683 156569 155864 155515 155164 154318 153961 152929 151898 151159 150416 149744 149023 148245 147425 146740 146155 146077 145591 145039 143743 142141 141497 141418 140996 139764 139561 138744 137363 137185 136602 135967 135643 134975 134094 133808 133733 133099 132312 131357 13...

result:

ok correct plan

Test #38:

score: 36
Accepted
time: 90ms
memory: 55652kb

input:

200000 200000
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
9 191957
10 11
11 12
12 13
13 14
14 15
15 16
15 195223
15 196855
16 17
17 18
18 19
19 20
20 21
20 195602
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
...

output:

100
188701 186530 184449 182162 180927 179792 179142 178777 177524 176036 174573 174474 170959 169568 168677 167204 166872 162624 161775 161018 159676 159380 156191 153980 151266 147262 144369 141276 140583 139495 136532 135579 131724 128667 126164 123691 121661 120165 116941 116191 114242 112421 11...

result:

ok correct plan

Extra Test:

score: 0
Extra Test Passed