QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#46859#4665. Contemporary ArtistQingyuAC ✓45ms19668kbC++231.2kb2022-09-02 01:10:522022-09-02 01:10:54

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-02 01:10:54]
  • 评测
  • 测评结果:AC
  • 用时:45ms
  • 内存:19668kb
  • [2022-09-02 01:10:52]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n, k;
vector <int> son[2010];
int id[2010], dep[2010];
int f[2010];
void dfs(int cur, int fa) {
    f[cur] = fa;
    dep[cur] = dep[fa] + 1;
    for (auto i : son[cur]) if (i != fa) dfs(i, cur);
}
int cnt[2010][2010];
int main() {
    scanf("%d%d", &n, &k);
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        son[u].push_back(v);
        son[v].push_back(u);
    }
    dfs(1, 0);
    for (int i = 1; i <= n; i++) id[i] = i, son[i].clear();
    sort(id + 1, id + 1 + n, [](int x, int y) {
        return dep[x] < dep[y];
    });
    int ans = n;
    for (int i = 2; i <= n; i++) {
        int cur = id[i];
        son[cur].push_back(f[cur]);
        son[f[cur]].push_back(cur);
        memset(dep, 0, sizeof dep);
        dfs(cur, 0);
        for (int j = 1; j <= n; j++) if (dep[j]) cnt[cur][dep[j] - 1]++;
        for (int j = 1; j <= n; j++) {
            cnt[cur][j] += cnt[cur][j - 1];
            if (cnt[cur][j] > k) ans = min(ans, j - 1);
        }
    }
    int ans2 = k;
    for (int i = 2; i <= n; i++) ans2 = 1ll * ans2 * (k - cnt[i][ans] + 1) % 998244353;
    cout << ans + 1 << ' ' << ans2 << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 2
1 2
1 3
1 4

output:

2 2

result:

ok 2 number(s): "2 2"

Test #2:

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

input:

4 3
1 2
1 3
1 4

output:

2 24

result:

ok 2 number(s): "2 24"

Test #3:

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

input:

5 4
1 2
1 3
1 4
4 5

output:

3 48

result:

ok 2 number(s): "3 48"

Test #4:

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

input:

2 1
1 2

output:

1 1

result:

ok 2 number(s): "1 1"

Test #5:

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

input:

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

output:

2 322828856

result:

ok 2 number(s): "2 322828856"

Test #6:

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

input:

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

output:

2 322828856

result:

ok 2 number(s): "2 322828856"

Test #7:

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

input:

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

output:

8 40320

result:

ok 2 number(s): "8 40320"

Test #8:

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

input:

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

output:

1 1

result:

ok 2 number(s): "1 1"

Test #9:

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

input:

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

output:

2 584621989

result:

ok 2 number(s): "2 584621989"

Test #10:

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

input:

20 12
2 11
9 1
3 2
2 14
1 2
20 5
8 6
18 12
5 1
16 9
12 6
13 9
12 17
19 13
15 8
9 10
1 4
6 2
6 7

output:

4 411254173

result:

ok 2 number(s): "4 411254173"

Test #11:

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

input:

21 5
16 19
1 20
6 12
1 8
7 1
1 3
4 1
14 8
11 16
11 13
1 2
15 17
1 9
10 15
3 6
21 1
10 9
5 4
1 18
11 1

output:

2 226486909

result:

ok 2 number(s): "2 226486909"

Test #12:

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

input:

22 17
19 20
2 5
9 8
4 3
1 2
17 16
6 5
10 11
2 3
7 6
19 10
12 13
18 6
14 15
21 20
7 8
22 21
6 10
12 9
13 14
16 10

output:

8 714329934

result:

ok 2 number(s): "8 714329934"

Test #13:

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

input:

23 20
13 9
3 6
4 7
17 23
14 19
16 22
15 21
6 10
3 1
4 2
12 17
2 1
6 9
5 3
8 5
8 12
7 11
10 14
11 16
15 20
13 18
10 15

output:

10 91151912

result:

ok 2 number(s): "10 91151912"

Test #14:

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

input:

24 21
3 6
2 1
19 22
9 12
11 8
14 11
21 18
4 1
19 16
15 18
4 7
20 17
10 13
6 9
15 12
16 13
17 14
24 21
3 1
7 10
23 20
8 5
2 5

output:

14 125580172

result:

ok 2 number(s): "14 125580172"

Test #15:

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

input:

24 6
14 8
16 10
13 7
9 3
13 19
8 2
14 20
23 17
5 1
3 1
6 12
4 1
10 4
2 1
11 5
15 21
1 6
1 7
22 16
18 12
11 17
18 24
15 9

output:

2 239743846

result:

ok 2 number(s): "2 239743846"

Test #16:

score: 0
Accepted
time: 30ms
memory: 19516kb

input:

2000 1971
416 1
1 1255
1 841
1011 1
1 430
1 649
1 1389
794 1
1784 1
1931 1
1237 1
1 351
1385 1
1675 1
1 1073
571 1
1518 1
1 510
1 108
634 1
1 1639
1489 1
1291 1
1 516
1 1001
1 29
1 728
1 648
1 146
1 1846
1 1757
1451 1
1 230
605 1
877 1
469 1
1 1390
1 32
532 1
1 468
1647 1
1 784
1 1892
1574 1
750 1
5...

output:

2 479367127

result:

ok 2 number(s): "2 479367127"

Test #17:

score: 0
Accepted
time: 30ms
memory: 19604kb

input:

2000 1971
416 2
2 1255
2 841
1011 2
2 430
2 649
2 1389
794 2
1784 2
1931 2
1237 2
2 351
1385 2
1675 2
2 1073
571 2
1518 2
2 510
2 108
634 2
2 1639
1489 2
1291 2
2 516
2 1001
2 29
2 728
2 648
2 146
2 1846
2 1757
1451 2
2 230
605 2
877 2
469 2
2 1390
2 32
532 2
2 468
1647 2
2 784
2 1892
1574 2
750 2
5...

output:

2 479367127

result:

ok 2 number(s): "2 479367127"

Test #18:

score: 0
Accepted
time: 27ms
memory: 19636kb

input:

2000 1971
416 415
1254 1255
840 841
1011 1010
429 430
648 649
1388 1389
794 793
1784 1783
1931 1930
1237 1236
350 351
1385 1384
1675 1674
1072 1073
571 570
1518 1517
509 510
107 108
634 633
1638 1639
1489 1488
1291 1290
515 516
1000 1001
28 29
727 728
647 648
145 146
1845 1846
1756 1757
1451 1450
22...

output:

1971 851223899

result:

ok 2 number(s): "1971 851223899"

Test #19:

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

input:

199 79
44 45
11 12
135 136
114 113
181 182
41 42
170 171
77 76
134 135
70 71
70 69
24 25
100 101
106 105
81 82
126 125
15 16
44 43
194 193
6 7
5 6
185 186
169 170
34 35
168 167
179 180
9 10
51 50
182 183
143 144
15 14
133 132
152 151
101 102
143 142
127 128
63 62
156 157
5 4
166 167
62 61
29 28
24 2...

output:

79 138799739

result:

ok 2 number(s): "79 138799739"

Test #20:

score: 0
Accepted
time: 37ms
memory: 19512kb

input:

2000 62
454 227
1216 608
22 11
784 392
443 221
653 326
1997 998
376 752
196 393
820 410
62 124
1868 934
78 39
328 164
211 422
1548 774
243 486
911 1823
402 805
623 1246
1740 870
1948 974
378 756
554 277
383 767
253 506
892 446
965 1931
1139 569
927 1855
1510 755
371 743
1269 634
8 17
595 297
331 662...

output:

10 194695931

result:

ok 2 number(s): "10 194695931"

Test #21:

score: 0
Accepted
time: 26ms
memory: 19516kb

input:

2000 1486
499 1497
1951 650
70 209
176 527
588 1763
470 1409
448 149
287 862
499 1498
1142 381
467 1401
301 100
513 1539
1700 567
541 1623
976 325
436 145
1835 612
17 50
507 1522
1017 339
179 60
590 1769
539 1617
1073 358
500 1500
128 384
1328 443
326 977
646 1938
169 506
941 314
68 23
651 217
1404 ...

output:

13 595243519

result:

ok 2 number(s): "13 595243519"

Test #22:

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

input:

2000 1614
1525 381
88 353
137 548
1587 397
1205 301
1303 326
1699 425
853 213
133 533
227 57
307 1226
1603 401
677 169
187 747
423 1690
419 105
303 76
1079 270
421 105
8 33
113 453
10 38
496 1982
519 130
1809 452
512 128
478 1913
553 138
458 1831
134 535
1185 296
431 1722
5 21
687 172
1557 389
106 4...

output:

11 468146989

result:

ok 2 number(s): "11 468146989"

Test #23:

score: 0
Accepted
time: 15ms
memory: 19584kb

input:

2000 462
261 1566
272 1629
322 1928
608 102
946 158
1165 194
282 1693
1514 253
60 361
821 137
1854 309
281 47
367 61
109 653
375 63
159 952
251 1507
39 234
114 681
700 117
1246 208
269 1613
1074 179
605 101
1379 230
328 1968
293 1758
466 78
175 29
333 1996
206 1235
1807 301
153 914
182 1093
309 1850...

output:

7 889783504

result:

ok 2 number(s): "7 889783504"

Test #24:

score: 0
Accepted
time: 21ms
memory: 19632kb

input:

2000 154
100 995
1515 152
305 31
1760 176
13 2
124 13
1373 138
1194 120
46 460
1812 182
1582 159
1957 196
4 38
72 714
200 1994
1444 145
127 1268
196 1958
1152 116
112 1119
698 70
606 61
167 1671
74 740
1375 138
1007 101
293 30
1941 194
70 701
70 7
221 22
135 1342
925 93
76 756
898 90
1434 144
656 66...

output:

5 8848525

result:

ok 2 number(s): "5 8848525"

Test #25:

score: 0
Accepted
time: 25ms
memory: 19668kb

input:

2000 1002
155 1859
685 57
1708 143
1032 86
956 80
110 10
630 53
73 866
92 1101
40 476
158 1891
1873 156
137 1643
105 1251
463 39
711 60
83 987
122 1465
12 143
1654 138
135 1610
1822 152
134 1602
166 1992
232 20
81 968
1400 117
40 475
107 1285
224 19
1212 101
1374 115
163 14
765 64
55 652
1625 136
92...

output:

6 42533897

result:

ok 2 number(s): "6 42533897"

Test #26:

score: 0
Accepted
time: 15ms
memory: 19664kb

input:

2000 426
87 1125
19 237
57 5
75 967
13 165
22 284
143 1852
17 212
65 845
102 1315
64 822
153 1990
1502 116
133 1727
246 19
367 29
1349 104
907 70
286 22
942 73
1009 78
121 1568
1 4
3 30
6 73
15 186
74 952
74 6
782 61
101 1310
91 7
100 1297
15 188
70 899
147 1900
1373 106
52 669
1223 94
118 1530
1652...

output:

6 204251913

result:

ok 2 number(s): "6 204251913"

Test #27:

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

input:

2000 555
1673 120
81 1124
52 727
1016 73
1396 100
1773 127
131 1823
234 17
93 1295
82 1140
1374 99
70 970
98 1363
1336 96
402 29
1 12
1965 141
676 49
1696 122
885 64
1106 79
24 326
847 61
33 3
11 150
233 17
16 213
50 689
578 42
110 1536
56 777
1075 77
50 696
1523 109
58 802
123 1721
29 397
141 1963
...

output:

6 506131320

result:

ok 2 number(s): "6 506131320"

Test #28:

score: 0
Accepted
time: 28ms
memory: 19456kb

input:

2000 1979
77 1144
32 480
1997 134
20 300
57 848
61 903
25 373
1059 71
20 299
20 297
640 43
74 1105
839 56
25 364
168 12
107 1605
186 13
650 44
1347 90
102 1526
24 359
776 52
216 15
44 653
109 1634
1608 108
30 437
126 1890
1303 87
68 1008
31 455
15 220
1811 121
393 27
226 15
1081 72
116 8
103 1540
51...

output:

6 808381559

result:

ok 2 number(s): "6 808381559"

Test #29:

score: 0
Accepted
time: 25ms
memory: 19408kb

input:

2000 1403
1107 70
42 671
1115 70
212 14
1322 83
1946 122
701 44
304 19
84 1339
33 517
620 39
87 1389
112 1789
1897 119
9 130
19 292
93 1477
121 1932
23 354
15 235
119 1905
155 10
1152 72
231 15
84 1333
66 1048
89 1424
1749 110
9 133
19 290
372 24
1311 82
1930 121
2 23
1997 125
14 215
642 41
1187 75
...

output:

6 410120047

result:

ok 2 number(s): "6 410120047"

Test #30:

score: 0
Accepted
time: 20ms
memory: 19612kb

input:

2000 379
427 23
1821 96
286 15
63 1193
95 1797
62 1172
103 1943
74 1403
76 1441
81 1523
5 1
1710 90
604 32
110 6
118 7
376 20
52 984
530 28
350 19
222 12
27 504
74 1393
37 697
31 583
1496 79
91 5
278 15
1538 81
347 19
28 531
990 53
653 35
83 1564
75 1419
98 1857
94 1785
14 267
35 651
1322 70
18 342
...

output:

4 611491045

result:

ok 2 number(s): "4 611491045"

Test #31:

score: 0
Accepted
time: 28ms
memory: 19600kb

input:

2000 373
95 1890
132 7
45 888
41 811
957 48
29 564
1424 72
87 1733
29 567
48 956
760 38
10 199
576 29
306 16
99 1974
28 548
31 602
1620 81
66 1303
59 1169
35 694
362 19
66 1306
98 1960
1479 74
91 5
100 5
78 1560
1992 100
15 292
1913 96
79 1578
17 329
461 23
51 1002
10 184
90 1786
24 475
86 1721
38 7...

output:

4 531436733

result:

ok 2 number(s): "4 531436733"

Test #32:

score: 0
Accepted
time: 21ms
memory: 19512kb

input:

2000 1797
63 1315
968 47
1689 81
1558 75
780 38
815 39
41 850
19 390
60 1260
12 236
450 22
677 33
71 1473
65 1359
82 1705
55 1143
6 111
1824 87
44 909
68 1416
93 1944
55 3
53 1112
1110 53
1 7
1870 89
597 29
33 694
61 1280
42 872
83 1741
88 5
78 1627
79 1653
1564 75
726 35
7 142
12 250
143 7
1202 58
...

output:

6 550963013

result:

ok 2 number(s): "6 550963013"

Test #33:

score: 0
Accepted
time: 20ms
memory: 19532kb

input:

2000 1925
1837 84
918 42
884 41
43 944
26 556
47 1023
56 1231
47 1024
78 1698
59 1283
83 1814
630 29
1979 90
914 42
61 1333
6 133
6 112
52 1124
1110 51
71 1555
1631 75
5 108
1955 89
56 1228
52 1132
86 1886
4 82
1115 51
40 862
87 1914
67 1471
1695 77
402 19
55 1202
1727 79
1923 88
20 429
694 32
24 51...

output:

6 672638925

result:

ok 2 number(s): "6 672638925"

Test #34:

score: 0
Accepted
time: 23ms
memory: 19616kb

input:

2000 1717
21 1046
22 1082
31 1542
1420 29
1793 36
8 385
887 18
22 1055
166 4
26 1275
12 562
2 87
29 1408
1002 21
11 512
21 1026
16 769
1560 32
22 1
536 11
760 16
25 1239
19 919
5 227
589 12
2000 40
23 1111
405 9
25 1246
3 113
24 1173
38 1899
596 12
35 1731
754 16
796 16
1132 23
1699 34
28 1372
1669 ...

output:

4 130287621

result:

ok 2 number(s): "4 130287621"

Test #35:

score: 0
Accepted
time: 16ms
memory: 19668kb

input:

2000 1971
416 20
35 1255
29 841
1011 31
20 430
25 649
37 1389
794 28
1784 42
1931 43
1237 35
18 351
1385 37
1675 40
32 1073
571 23
1518 38
22 510
10 108
634 25
40 1639
1489 38
1291 35
22 516
31 1001
5 29
26 728
25 648
12 146
42 1846
41 1757
1451 38
15 230
605 24
877 29
469 21
37 1390
5 32
532 23
21 ...

output:

7 186894749

result:

ok 2 number(s): "7 186894749"

Test #36:

score: 0
Accepted
time: 27ms
memory: 19512kb

input:

2000 303
1544 1528
63 157
124 113
1432 1350
215 487
1246 1712
108 149
585 1057
188 702
1370 65
82 131
777 76
147 1810
5 389
165 912
894 648
418 1868
1903 1585
372 1641
1984 1744
28 51
1811 1872
527 299
1261 373
187 154
32 1191
1095 1145
157 484
1874 1459
614 606
646 35
277 1025
1590 838
34 1884
666 ...

output:

8 88900547

result:

ok 2 number(s): "8 88900547"

Test #37:

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

input:

2000 629
58 447
1938 1
1 1798
1 832
1 1209
482 652
1020 461
1642 1
208 278
667 1
1433 1884
139 1032
1 1973
1595 1
1175 199
86 1
1712 1
868 1
1431 1303
1818 1
562 886
1 813
444 1
1 1779
1914 1013
1 1611
1458 1077
200 226
717 13
582 1
1475 477
964 1301
1488 187
1 550
271 59
1 1124
1295 1
1 950
1499 17...

output:

2 937403029

result:

ok 2 number(s): "2 937403029"

Test #38:

score: 0
Accepted
time: 31ms
memory: 19512kb

input:

2000 629
58 447
1938 1937
1797 1798
831 832
1208 1209
482 652
1020 461
1642 1641
208 278
667 666
1433 1884
139 1032
1972 1973
1595 1594
1175 199
86 85
1712 1711
868 867
1431 1303
1818 1817
562 886
812 813
444 443
1778 1779
1914 1013
1610 1611
1458 1077
200 226
717 13
582 581
1475 477
964 1301
1488 1...

output:

16 690367584

result:

ok 2 number(s): "16 690367584"

Test #39:

score: 0
Accepted
time: 34ms
memory: 19500kb

input:

2000 1971
388 416
1255 1206
841 801
967 1011
430 402
649 614
1389 1337
755 794
1725 1784
1870 1931
1188 1237
351 325
1333 1385
1618 1675
1073 1028
538 571
1464 1518
510 479
108 94
599 634
1639 1583
1435 1489
1241 1291
516 485
1001 957
29 22
728 691
648 613
146 130
1846 1786
1757 1699
1398 1451
230 2...

output:

115 970706362

result:

ok 2 number(s): "115 970706362"

Test #40:

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

input:

2000 62
454 452
1216 1214
22 20
784 782
443 441
653 651
1997 1995
750 752
391 393
820 818
122 124
1868 1866
78 76
328 326
420 422
1548 1546
484 486
1821 1823
803 805
1244 1246
1740 1738
1948 1946
754 756
554 552
765 767
504 506
892 890
1929 1931
1139 1137
1853 1855
1510 1508
741 743
1269 1267
15 17
...

output:

62 396199761

result:

ok 2 number(s): "62 396199761"

Test #41:

score: 0
Accepted
time: 27ms
memory: 19620kb

input:

2000 1614
1525 1521
349 353
544 548
1587 1583
1205 1201
1303 1299
1699 1695
853 849
529 533
227 223
1222 1226
1603 1599
677 673
743 747
1686 1690
419 415
303 299
1079 1075
421 417
29 33
449 453
34 38
1978 1982
519 515
1809 1805
512 508
1909 1913
553 549
1827 1831
531 535
1185 1181
1718 1722
17 21
68...

output:

808 874330647

result:

ok 2 number(s): "808 874330647"

Test #42:

score: 0
Accepted
time: 45ms
memory: 19612kb

input:

2000 154
985 995
1515 1505
305 295
1760 1750
13 3
124 114
1373 1363
1194 1184
450 460
1812 1802
1582 1572
1957 1947
28 38
704 714
1984 1994
1444 1434
1258 1268
1948 1958
1152 1142
1109 1119
698 688
606 596
1661 1671
730 740
1375 1365
1007 997
293 283
1941 1931
691 701
70 60
221 211
1332 1342
925 915...

output:

32 592507717

result:

ok 2 number(s): "32 592507717"

Test #43:

score: 0
Accepted
time: 28ms
memory: 19600kb

input:

2000 1488
1125 1095
720 750
533 503
1582 1612
310 340
1317 1287
885 915
1441 1471
1661 1631
1902 1932
1942 1912
1314 1344
1934 1964
263 293
189 159
1312 1282
613 643
1217 1247
978 1008
130 100
553 583
98 68
553 523
773 743
286 316
590 620
957 927
1836 1806
1673 1643
1106 1076
1694 1664
1553 1583
184...

output:

100 68432216

result:

ok 2 number(s): "100 68432216"

Test #44:

score: 0
Accepted
time: 33ms
memory: 19572kb

input:

2000 1717
996 1046
1032 1082
1492 1542
1420 1370
1793 1743
335 385
887 837
1005 1055
166 116
1225 1275
512 562
37 87
1358 1408
1002 952
462 512
976 1026
719 769
1560 1510
22 1
536 486
760 710
1189 1239
869 919
177 227
589 539
2000 1950
1061 1111
405 355
1196 1246
63 113
1123 1173
1849 1899
596 546
1...

output:

70 992214510

result:

ok 2 number(s): "70 992214510"

Test #45:

score: 0
Accepted
time: 25ms
memory: 19504kb

input:

2000 1473
649 549
1154 1254
1205 1105
1193 1293
1608 1508
1372 1472
629 529
1048 948
1271 1171
516 416
1277 1377
47 1
1314 1214
705 605
1372 1272
242 342
1 20
1362 1262
1130 1230
1858 1758
39 1
616 516
777 877
85 1
432 532
402 302
429 329
234 334
1335 1235
683 583
1246 1346
1345 1445
544 644
1683 17...

output:

30 40533557

result:

ok 2 number(s): "30 40533557"

Test #46:

score: 0
Accepted
time: 26ms
memory: 19624kb

input:

2000 1003
1 674
674 420
629 1
629 1302
1170 629
1 35
35 711
35 1888
780 35
569 1
1529 569
569 59
1823 569
1705 569
1 1065
1805 1065
1065 1014
75 1065
1065 14
264 1065
993 1
1550 993
1467 993
993 650
1263 993
993 876
1 1017
213 1017
290 1017
1017 975
1017 1938
1017 1395
646 1017
931 1017
1017 1030
1 ...

output:

3 34650057

result:

ok 2 number(s): "3 34650057"

Test #47:

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

input:

2000 447
1210 1
1809 1
1809 106
1809 1032
1 210
207 210
210 302
1 1387
825 1387
1387 1219
1387 646
1945 1387
1387 242
1704 1
411 1704
1704 1204
453 1704
1149 1704
1704 1833
626 1704
903 1
903 692
1635 903
903 1615
903 307
903 1301
903 1334
903 285
1605 903
903 1015
1676 1
483 1676
246 1676
382 1676
...

output:

2 613421052

result:

ok 2 number(s): "2 613421052"

Test #48:

score: 0
Accepted
time: 19ms
memory: 19520kb

input:

2000 1112
1334 1
194 1334
1334 626
900 1
900 1328
818 900
1 713
552 713
1273 713
968 1
486 968
972 968
1 620
1069 620
1 1769
1769 705
1769 337
318 1
1926 318
318 1712
318 1288
1535 318
997 318
735 1
1690 735
1360 735
735 24
735 629
735 821
1 23
803 23
1407 23
23 612
376 23
564 23
239 23
1572 1
869 1...

output:

4 953917399

result:

ok 2 number(s): "4 953917399"

Test #49:

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

input:

2000 1875
1182 1
1942 1182
1 855
855 228
179 855
855 1809
1 492
1404 492
1717 492
1 1097
211 1097
387 1097
141 1097
1 613
613 416
661 613
613 333
1172 613
613 1373
613 811
613 1632
613 1152
180 1
180 1932
1823 180
668 180
1626 180
658 180
180 598
823 180
180 1240
951 1
951 734
951 448
951 73
1862 95...

output:

4 527210726

result:

ok 2 number(s): "4 527210726"

Test #50:

score: 0
Accepted
time: 27ms
memory: 19516kb

input:

2000 997
1 12
35 1
1814 35
1 953
953 1808
847 953
1291 953
19 1
1869 19
1870 19
19 1829
1 593
740 593
593 1850
593 1417
901 1
1989 901
952 901
901 1756
1 1488
1941 1488
1488 404
1488 1061
1488 65
1991 1
1991 90
1991 254
420 1991
1991 1398
1991 1378
1991 1852
885 1
1322 885
661 885
885 324
885 549
10...

output:

2 122435823

result:

ok 2 number(s): "2 122435823"

Test #51:

score: 0
Accepted
time: 26ms
memory: 19516kb

input:

2000 703
137 1
137 301
17 1
4 17
115 17
17 1395
17 79
17 159
1818 17
1 634
891 634
1866 634
634 1763
634 494
813 634
232 634
1622 634
1006 1
1862 1006
1006 954
1006 287
979 1006
842 1006
1850 1006
710 1006
1006 1149
1 1904
404 1904
718 1904
1904 987
714 1904
1904 271
1904 1491
1904 1958
1565 1904
17...

output:

2 114168331

result:

ok 2 number(s): "2 114168331"

Test #52:

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

input:

2000 1392
1294 1
1294 1688
1870 1
1870 501
519 1870
1 1846
1160 1846
1147 1846
1174 1846
1708 1846
1846 529
1 1479
578 1479
1479 87
333 1479
1479 1798
1852 1479
1479 604
122 1
122 1322
122 821
122 913
122 744
974 122
1768 1
1236 1768
1768 1403
1768 1886
1768 768
1768 1646
1768 1490
1324 1
699 1324
1...

output:

4 188763789

result:

ok 2 number(s): "4 188763789"

Test #53:

score: 0
Accepted
time: 21ms
memory: 19584kb

input:

2000 1145
698 1
1809 1
840 1809
1 540
472 540
73 540
1370 540
1 30
30 1197
30 1712
100 30
1 241
581 241
241 1836
1454 241
1047 241
1216 1
1216 352
1117 1216
1216 138
1216 233
1578 1216
1 1835
659 1835
1835 158
1835 1866
1835 690
1173 1835
1835 1994
1870 1
1667 1870
1870 1212
568 1870
1870 1963
1870 ...

output:

4 428377024

result:

ok 2 number(s): "4 428377024"

Test #54:

score: 0
Accepted
time: 21ms
memory: 19528kb

input:

2000 1259
820 1
820 1693
820 113
730 820
820 22
1634 820
820 399
1800 820
1611 820
467 820
820 1518
820 1505
820 1973
972 820
1482 820
820 678
820 1308
1441 1
1084 1441
1077 1441
1679 1441
120 1441
1441 590
1441 658
1771 1441
1441 963
1441 1386
1838 1441
1807 1441
95 1441
1441 511
1441 1296
1604 144...

output:

4 768343109

result:

ok 2 number(s): "4 768343109"

Test #55:

score: 0
Accepted
time: 25ms
memory: 19392kb

input:

2000 603
1 839
839 828
839 1249
1786 839
839 1285
839 126
529 839
839 1194
1244 839
839 1589
87 839
1057 839
839 688
1961 839
1768 839
1091 839
850 839
837 839
862 839
1778 839
839 589
839 1228
523 839
839 1374
1960 839
1428 839
839 514
839 813
839 807
839 310
839 1317
839 360
17 839
839 351
1204 83...

output:

2 230957829

result:

ok 2 number(s): "2 230957829"

Test #56:

score: 0
Accepted
time: 16ms
memory: 19592kb

input:

2000 1803
1 1667
1667 306
1667 1383
1 1457
1457 869
1580 1457
1562 1457
1457 512
1457 409
824 1457
878 1457
286 1457
1457 1960
1457 420
1457 1499
330 1457
699 1457
1357 1457
1457 1557
1457 1970
97 1457
1457 94
1457 281
1457 712
1457 720
1457 67
1457 924
438 1457
1457 1275
1618 1457
357 1457
211 1457...

output:

4 442705250

result:

ok 2 number(s): "4 442705250"

Test #57:

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

input:

2000 985
1 589
589 882
1 1684
1684 141
1265 1684
1749 1684
1684 1788
1684 87
515 1
515 592
515 1001
515 962
515 1867
1459 515
1577 515
515 1347
515 1360
515 1035
1979 515
515 151
515 51
1794 515
1237 1
1237 1925
1237 654
1237 700
1237 1780
1237 125
1237 1004
1237 1508
1237 546
856 1237
1237 976
1951...

output:

2 274940175

result:

ok 2 number(s): "2 274940175"

Test #58:

score: 0
Accepted
time: 30ms
memory: 19628kb

input:

2000 586
777 1
777 254
777 231
777 1619
323 777
198 777
1 766
766 8
1401 766
1046 766
1599 766
766 1660
1370 766
1 1141
1141 42
1094 1141
1141 1956
30 1141
1141 514
1141 1517
1141 1668
1141 1096
446 1141
1159 1
1159 1984
1381 1159
1833 1159
476 1159
1159 1097
1159 191
1159 1931
86 1159
1682 1159
115...

output:

2 196533340

result:

ok 2 number(s): "2 196533340"

Test #59:

score: 0
Accepted
time: 27ms
memory: 19664kb

input:

2000 1277
1906 1
1 1964
1964 152
1964 1357
893 1964
1764 1964
1518 1
1518 134
1775 1518
1518 1511
1227 1518
1518 1673
625 1
1307 625
625 1524
625 1517
625 1529
625 1911
1 795
795 1314
795 614
795 1601
933 795
889 795
795 1108
795 1290
1 1685
1881 1685
1685 1226
1940 1685
1685 732
1685 1286
1032 1685...

output:

4 302861488

result:

ok 2 number(s): "4 302861488"

Test #60:

score: 0
Accepted
time: 21ms
memory: 19512kb

input:

2000 1736
346 1
346 892
4 346
346 160
346 572
1564 346
346 802
346 220
346 54
346 32
346 1305
346 1789
745 346
1668 346
661 346
1365 346
346 885
174 346
1449 346
346 1028
346 581
1269 346
1370 346
346 1463
562 346
346 1349
346 1738
1004 346
1261 346
1299 346
1203 346
597 346
1881 346
446 346
345 346...

output:

4 738543392

result:

ok 2 number(s): "4 738543392"

Test #61:

score: 0
Accepted
time: 18ms
memory: 19600kb

input:

2000 254
863 1
236 863
863 1264
1213 863
97 863
146 1
146 624
616 146
135 146
1329 146
146 1266
392 146
1172 146
146 394
146 1161
146 1121
1796 146
146 1866
146 1850
146 1455
146 1128
1657 146
146 744
146 1310
1220 146
1903 146
167 146
146 1160
726 146
1478 146
892 146
776 146
1094 1
1754 1094
1094 ...

output:

2 966922737

result:

ok 2 number(s): "2 966922737"

Test #62:

score: 0
Accepted
time: 23ms
memory: 19664kb

input:

2000 262
1 208
1381 208
1118 208
208 1852
208 723
208 1403
208 418
208 844
208 1807
208 344
1767 208
208 906
1 1329
985 1329
626 1329
1226 1329
1329 984
16 1329
1329 331
1526 1329
1401 1329
1788 1329
1329 1936
1329 1022
1495 1329
1893 1329
989 1
1983 989
1961 989
989 1101
989 761
989 674
106 989
989...

output:

2 886133745

result:

ok 2 number(s): "2 886133745"

Test #63:

score: 0
Accepted
time: 26ms
memory: 19624kb

input:

2000 603
1 983
1001 983
983 792
983 51
1 1576
1576 1201
1576 712
1576 216
1576 1770
1485 1
1485 1143
1485 1887
1313 1485
1485 1962
1485 33
1 1480
1480 1616
1480 298
1734 1480
1152 1480
85 1480
774 1480
1480 430
1480 1957
1480 1146
1492 1480
1480 947
1 1058
1934 1058
1705 1058
1058 1402
1058 1572
745...

output:

2 230957829

result:

ok 2 number(s): "2 230957829"

Test #64:

score: 0
Accepted
time: 31ms
memory: 19620kb

input:

2000 7
1 1930
487 1
1290 487
1738 1
1654 1738
1535 1738
1738 344
454 1
989 454
454 1433
262 454
517 454
193 454
1 583
1510 583
914 583
583 1398
583 1908
759 583
256 583
583 159
583 1206
1 635
635 1805
635 906
1143 635
92 635
635 905
1144 635
635 360
635 987
386 635
635 298
1 200
35 200
118 200
200 1...

output:

2 312375346

result:

ok 2 number(s): "2 312375346"

Test #65:

score: 0
Accepted
time: 28ms
memory: 19660kb

input:

2000 999
1 984
1914 984
984 261
176 1
176 315
176 669
176 197
176 487
958 176
361 1
361 1649
575 361
361 534
548 361
532 361
361 1617
1480 361
169 1
169 1644
169 1149
146 169
1401 169
1142 169
169 679
169 1958
1881 169
692 169
1572 169
566 169
1 1902
206 1902
1902 89
1634 1902
608 1902
1148 1902
288...

output:

2 681500712

result:

ok 2 number(s): "2 681500712"

Test #66:

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

input:

2000 1373
327 1
1096 327
410 327
327 722
29 327
327 1470
1 241
32 241
86 241
1065 241
241 858
241 718
241 490
241 338
1591 241
241 1529
874 241
1377 1
1377 985
1377 480
1807 1377
1377 179
975 1377
1037 1377
1377 217
1588 1377
1377 1925
757 1377
1377 88
1377 1712
1794 1377
620 1377
1377 12
1377 52
15...

output:

4 187142152

result:

ok 2 number(s): "4 187142152"

Test #67:

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

input:

2000 39
1 1273
1413 1273
183 1273
1273 713
361 1273
1273 93
1104 1
1168 1104
1104 948
1104 1640
1104 990
408 1104
1104 798
1104 787
1799 1104
1064 1104
1104 1157
1945 1104
1915 1104
1627 1104
1104 1230
1104 1292
832 1104
978 1104
1104 1049
552 1104
1422 1104
1543 1104
1104 10
1104 556
976 1104
1117 ...

output:

2 440966242

result:

ok 2 number(s): "2 440966242"

Test #68:

score: 0
Accepted
time: 27ms
memory: 19596kb

input:

2000 1034
1530 1
886 1530
1627 1530
1530 1350
526 1530
1530 1613
1530 1195
1530 1311
1530 1232
1530 415
1530 1325
1530 590
1530 1729
1942 1530
1157 1530
1104 1530
1530 1208
1719 1
1719 1023
1719 447
1719 1089
1719 1422
1522 1719
1719 1117
1719 893
1719 254
1368 1719
1719 1026
576 1719
1719 186
659 1...

output:

3 218782408

result:

ok 2 number(s): "3 218782408"

Test #69:

score: 0
Accepted
time: 25ms
memory: 19616kb

input:

2000 405
1496 1
1542 1496
1496 550
1496 1289
1984 1496
869 1496
519 1496
1391 1496
1279 1496
1669 1496
1496 881
1496 1554
705 1496
1496 1278
1496 109
778 1
778 836
567 778
778 361
471 778
778 20
778 616
778 357
659 778
227 778
778 1751
937 778
1922 778
778 913
778 1682
778 1952
778 948
458 778
1101 ...

output:

2 192786137

result:

ok 2 number(s): "2 192786137"

Test #70:

score: 0
Accepted
time: 27ms
memory: 19512kb

input:

2000 1466
815 1
815 1281
1 1803
1939 1803
388 1803
1803 467
312 1803
1803 1728
1535 1803
1803 1259
1803 1534
1 1680
1680 479
886 1680
1233 1680
1680 626
158 1680
205 1680
1680 60
1680 1279
1680 319
384 1680
1680 1573
1680 605
1680 1172
436 1680
597 1680
1016 1680
1680 1133
750 1680
1474 1680
1 1991
...

output:

4 639281460

result:

ok 2 number(s): "4 639281460"

Test #71:

score: 0
Accepted
time: 24ms
memory: 19620kb

input:

2000 1957
429 1
578 429
429 523
966 429
1351 429
429 1281
1 1271
1271 1445
1271 1734
1209 1271
1446 1271
1271 410
301 1271
1271 1814
1271 88
156 1271
1271 120
408 1271
741 1271
760 1271
1271 354
1 1001
1585 1001
1001 1745
1001 1611
1327 1001
1798 1001
1001 1254
1001 1960
1001 936
1593 1001
1001 1816...

output:

4 837276678

result:

ok 2 number(s): "4 837276678"

Test #72:

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

input:

2000 230
1 1013
1013 976
1459 1013
1013 451
1013 478
1013 1195
1437 1013
183 1013
1564 1013
1265 1013
1013 144
1208 1013
1013 462
361 1
637 361
361 167
361 1019
395 361
244 361
361 219
361 1610
361 366
361 450
361 1481
361 765
103 361
1779 361
361 962
809 361
1576 361
627 361
1954 361
134 361
361 66...

output:

2 332447257

result:

ok 2 number(s): "2 332447257"

Test #73:

score: 0
Accepted
time: 25ms
memory: 19588kb

input:

2000 1915
1 1073
1073 1790
778 1073
822 1073
1073 1230
336 1073
1108 1073
1073 329
1073 310
1757 1073
1073 1119
1073 1733
1073 1264
1172 1073
982 1073
774 1073
1073 1152
1139 1073
1007 1073
1073 656
1908 1073
169 1073
1073 1575
1581 1073
1725 1073
1073 109
1073 744
985 1073
1228 1073
1544 1
200 1544...

output:

4 412388953

result:

ok 2 number(s): "4 412388953"

Test #74:

score: 0
Accepted
time: 20ms
memory: 19548kb

input:

2000 233
1432 1
1 1522
1522 1846
1009 1522
1522 1602
1522 34
1522 476
1522 650
1585 1522
1522 332
1522 70
1522 1357
1522 1165
1708 1522
1083 1
1966 1083
1245 1083
1083 956
832 1083
1198 1083
434 1083
1083 920
458 1083
1817 1083
1083 379
1468 1083
1799 1083
1151 1083
1083 954
1083 629
1083 1034
1859 ...

output:

2 978618345

result:

ok 2 number(s): "2 978618345"

Test #75:

score: 0
Accepted
time: 19ms
memory: 19628kb

input:

2000 1598
1 996
996 400
996 368
593 996
996 1294
1956 1
880 1956
1956 1629
1956 1043
1956 656
1956 93
1956 858
1069 1
1487 1069
1337 1069
1398 1069
694 1069
1069 798
1069 925
1069 1419
1069 1426
1069 1904
1824 1069
772 1069
1069 180
1069 157
1507 1069
1199 1069
1 22
22 1472
139 22
22 730
22 769
972 ...

output:

4 834812101

result:

ok 2 number(s): "4 834812101"

Test #76:

score: 0
Accepted
time: 27ms
memory: 19516kb

input:

2000 876
1 1068
1419 1068
429 1068
234 1068
870 1068
1157 1068
1068 498
1068 727
1068 1786
1393 1068
1 1287
1504 1287
995 1287
1287 661
305 1287
1287 102
1287 1520
248 1287
1287 532
1287 381
1287 411
458 1287
253 1287
1714 1287
1287 1217
1287 1250
1287 818
1745 1287
1287 1973
1204 1287
437 1287
1771...

output:

2 589780542

result:

ok 2 number(s): "2 589780542"

Test #77:

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

input:

2000 57
1382 1
1736 1382
1382 142
1382 344
552 1382
1382 917
1382 1217
1382 785
1382 484
1307 1
1307 1809
1754 1307
1687 1307
1307 1228
653 1307
1586 1307
1218 1307
1033 1307
1482 1307
794 1307
1307 895
1355 1307
1307 1233
1 1905
1905 1903
1152 1905
1905 1812
1284 1905
1232 1905
1506 1905
1886 1905
...

output:

2 111534760

result:

ok 2 number(s): "2 111534760"

Test #78:

score: 0
Accepted
time: 19ms
memory: 19512kb

input:

2000 903
1742 1
1883 1742
1 441
283 441
441 847
949 441
441 20
1 1844
1844 916
430 1844
1844 1181
1844 1075
1629 1844
1844 407
1844 1956
1844 615
1844 297
1 732
732 1218
1561 732
732 73
732 882
732 766
1114 732
754 732
732 908
732 713
1979 732
208 1
208 1704
208 824
208 1963
1189 208
266 208
1109 20...

output:

2 12768321

result:

ok 2 number(s): "2 12768321"

Test #79:

score: 0
Accepted
time: 30ms
memory: 19624kb

input:

2000 1505
1810 1
808 1810
1810 1911
1810 1159
978 1
978 585
978 241
978 1871
978 1259
978 1996
978 1203
978 1032
978 208
772 978
1 1332
1832 1332
1332 1878
559 1332
1332 421
1619 1332
347 1332
361 1332
500 1332
861 1332
1524 1332
130 1
910 130
130 122
130 888
942 130
131 130
130 1228
130 771
1761 13...

output:

4 211051739

result:

ok 2 number(s): "4 211051739"

Test #80:

score: 0
Accepted
time: 23ms
memory: 19396kb

input:

2000 229
601 1
601 71
1149 601
132 601
213 601
601 1728
601 1850
1336 601
779 601
1222 601
1408 601
601 915
529 601
601 345
601 1697
1465 601
566 601
1269 601
601 1596
601 190
601 1353
601 1114
1028 601
1354 601
265 601
900 601
1178 601
601 1625
1652 601
290 601
81 601
1415 601
1503 601
1206 601
601...

output:

2 42452802

result:

ok 2 number(s): "2 42452802"

Test #81:

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

input:

2000 28
1468 1
818 1468
1468 911
1468 1533
962 1468
494 1468
1468 529
1468 1025
215 1468
278 1468
479 1468
1 689
164 689
689 842
1718 689
689 826
777 689
1812 689
612 689
263 689
1477 689
802 689
689 1653
681 689
689 11
98 689
1754 689
115 689
1 232
232 1582
232 1345
232 1845
1687 232
232 1514
898 2...

output:

2 866600568

result:

ok 2 number(s): "2 866600568"

Test #82:

score: 0
Accepted
time: 26ms
memory: 19668kb

input:

2000 1228
1 1761
1 1891
423 1891
1 527
527 1185
527 1337
527 1157
551 527
1820 527
1 501
768 501
1678 501
501 1361
765 501
508 501
1132 501
501 10
1516 501
501 1045
501 944
1408 501
350 501
1868 501
995 501
501 1747
1932 501
820 501
749 501
501 661
967 501
501 1070
501 856
1 1179
1778 1179
433 1179
...

output:

4 627648043

result:

ok 2 number(s): "4 627648043"

Test #83:

score: 0
Accepted
time: 19ms
memory: 19600kb

input:

2000 1362
779 1
779 893
1 769
1366 769
664 769
42 769
769 1654
769 1135
2 1
306 2
1036 2
1700 2
1355 2
1675 2
540 2
2 948
566 2
1288 1
1288 591
373 1288
1288 273
1288 1785
1285 1288
1288 1574
319 1288
1288 404
355 1288
1288 1390
1288 632
1288 575
1 464
1127 464
464 556
464 1588
699 464
274 464
464 1...

output:

4 869344071

result:

ok 2 number(s): "4 869344071"

Test #84:

score: 0
Accepted
time: 19ms
memory: 19616kb

input:

2000 83
1881 1
1881 1115
1881 1458
1152 1
1087 1152
1152 1324
1152 189
1152 795
81 1152
1152 1034
838 1152
853 1152
1925 1152
1152 12
230 1152
1152 135
1817 1
1817 1017
1784 1817
249 1817
1416 1817
1817 1123
1817 1006
1817 383
1817 1127
1817 1390
1817 46
239 1817
353 1817
1817 1424
1566 1817
527 181...

output:

2 590584298

result:

ok 2 number(s): "2 590584298"

Test #85:

score: 0
Accepted
time: 21ms
memory: 19664kb

input:

2000 280
1978 1
1978 334
1732 1978
1623 1
519 1623
105 1623
1898 1623
1623 1210
236 1
1324 236
128 236
236 1426
236 517
236 17
236 679
1 1468
1043 1468
1468 748
315 1468
682 1468
494 1468
1468 1946
1 1619
1619 1558
1212 1619
1619 540
1619 593
987 1619
1619 1318
749 1619
1619 1797
1703 1619
669 1619
...

output:

2 259064827

result:

ok 2 number(s): "2 259064827"

Test #86:

score: 0
Accepted
time: 30ms
memory: 19584kb

input:

2000 127
1035 398
1989 1282
1411 710
135 1419
1640 256
733 252
1354 32
1933 306
1819 1556
436 230
921 1181
568 180
724 1258
1185 1291
585 433
1964 93
68 527
845 313
510 1317
597 185
598 1685
1462 983
186 1250
705 1302
1314 1186
951 920
1732 1465
392 546
1661 601
933 1812
588 434
1328 1294
1599 60
16...

output:

15 803153061

result:

ok 2 number(s): "15 803153061"

Test #87:

score: 0
Accepted
time: 39ms
memory: 19504kb

input:

2000 732
1445 1408
1932 1353
532 1516
1021 1505
1345 1011
1976 479
749 537
1234 1006
93 196
1134 1943
1288 1245
970 757
441 852
1054 50
1210 392
1696 11
250 1436
1500 986
1149 895
1130 1031
908 1561
1881 1922
1859 155
1851 1839
824 1099
1479 885
512 406
353 228
1792 1327
714 408
274 1167
1837 1372
1...

output:

46 643165172

result:

ok 2 number(s): "46 643165172"

Test #88:

score: 0
Accepted
time: 30ms
memory: 19652kb

input:

2000 233
183 1495
271 698
613 518
1559 1801
1185 1772
3 234
357 1091
1798 1571
402 376
1867 2000
888 1819
998 199
324 876
1264 1876
1103 1332
1292 534
1370 1299
607 1670
1164 38
1665 1106
329 1837
202 1239
156 1451
1353 1004
54 994
1247 1490
319 1215
905 105
1348 1459
246 866
1842 1095
250 11
1076 1...

output:

21 557008113

result:

ok 2 number(s): "21 557008113"

Test #89:

score: 0
Accepted
time: 24ms
memory: 19588kb

input:

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

output:

4 779243258

result:

ok 2 number(s): "4 779243258"

Test #90:

score: 0
Accepted
time: 31ms
memory: 19616kb

input:

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

output:

4 832974355

result:

ok 2 number(s): "4 832974355"

Test #91:

score: 0
Accepted
time: 33ms
memory: 19588kb

input:

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

output:

2 3596487

result:

ok 2 number(s): "2 3596487"

Test #92:

score: 0
Accepted
time: 30ms
memory: 19520kb

input:

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

output:

4 512168333

result:

ok 2 number(s): "4 512168333"

Test #93:

score: 0
Accepted
time: 32ms
memory: 19504kb

input:

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

output:

3 633709569

result:

ok 2 number(s): "3 633709569"

Test #94:

score: 0
Accepted
time: 39ms
memory: 19500kb

input:

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

output:

4 625299176

result:

ok 2 number(s): "4 625299176"

Test #95:

score: 0
Accepted
time: 30ms
memory: 19584kb

input:

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

output:

2 12827949

result:

ok 2 number(s): "2 12827949"

Test #96:

score: 0
Accepted
time: 26ms
memory: 19520kb

input:

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

output:

4 410511065

result:

ok 2 number(s): "4 410511065"

Test #97:

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

input:

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

output:

4 70410939

result:

ok 2 number(s): "4 70410939"

Test #98:

score: 0
Accepted
time: 25ms
memory: 19540kb

input:

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

output:

1 1

result:

ok 2 number(s): "1 1"

Test #99:

score: 0
Accepted
time: 24ms
memory: 19512kb

input:

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

output:

2 58397271

result:

ok 2 number(s): "2 58397271"

Test #100:

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

input:

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

output:

2 564324881

result:

ok 2 number(s): "2 564324881"

Test #101:

score: 0
Accepted
time: 35ms
memory: 19504kb

input:

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

output:

3 781931716

result:

ok 2 number(s): "3 781931716"

Test #102:

score: 0
Accepted
time: 35ms
memory: 19620kb

input:

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

output:

4 534506792

result:

ok 2 number(s): "4 534506792"

Test #103:

score: 0
Accepted
time: 19ms
memory: 19588kb

input:

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

output:

4 687273724

result:

ok 2 number(s): "4 687273724"

Test #104:

score: 0
Accepted
time: 31ms
memory: 19592kb

input:

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

output:

2 246554634

result:

ok 2 number(s): "2 246554634"

Test #105:

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

input:

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

output:

2 246554634

result:

ok 2 number(s): "2 246554634"