QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#311646#5049. TravelFantasy_BallAC ✓461ms67112kbC++146.3kb2024-01-22 16:40:202024-01-22 16:40:21

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 6180kb

input:

2 2 1
1 2
2 1

output:

6

result:

ok 1 number(s): "6"

Test #2:

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

input:

2 2 2
1 2
2 1

output:

30

result:

ok 1 number(s): "30"

Test #3:

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

input:

3 3 3
1 2
2 1
1 3

output:

103

result:

ok 1 number(s): "103"

Test #4:

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

input:

1 0 10

output:

3

result:

ok 1 number(s): "3"

Test #5:

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

input:

4 4 1
1 2
2 1
1 3
2 4

output:

6

result:

ok 1 number(s): "6"

Test #6:

score: 0
Accepted
time: 267ms
memory: 67096kb

input:

2000 2000 1000000000
354 318
1926 1078
262 94
1093 852
1296 668
1684 45
753 334
445 510
775 1032
1214 584
744 400
140 1879
1156 1551
449 904
1438 1317
90 699
1652 1690
1016 1913
1079 519
1140 1507
991 1461
790 1296
1767 29
91 1979
357 542
1549 1706
394 401
284 1172
88 1688
1143 375
876 628
1233 1204...

output:

251406997

result:

ok 1 number(s): "251406997"

Test #7:

score: 0
Accepted
time: 264ms
memory: 67096kb

input:

2000 2000 1000000000
582 1872
220 1681
1098 1250
1967 168
1914 1833
1449 1881
1887 1216
912 1519
1755 374
776 1208
1263 1853
1496 959
1448 1712
348 1602
552 1533
1615 801
1152 1867
1792 1000
296 1789
327 936
329 1630
1594 570
204 1786
700 1188
962 1791
968 956
1577 540
608 927
1403 1818
1291 479
109...

output:

251406997

result:

ok 1 number(s): "251406997"

Test #8:

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

input:

2000 2000 0
1375 214
1050 773
406 591
1367 1761
1838 32
1745 1893
1160 217
482 713
256 669
1392 1242
1134 423
462 797
1789 1519
1421 780
583 760
279 175
951 322
467 1094
476 1269
389 1528
1179 692
635 1211
1485 698
1684 310
1113 404
201 636
469 366
1587 1542
923 545
1009 12
235 51
478 1632
148 1464
...

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: 0
Accepted
time: 461ms
memory: 67112kb

input:

2000 2000 1
92 1531
1816 493
408 1187
1777 791
1235 617
723 1255
1432 1528
276 906
728 420
997 579
1767 864
556 955
1622 1277
1966 1005
1528 494
677 1094
727 1424
863 1404
354 1944
1167 1956
1436 26
1400 1573
67 526
1895 1438
1028 1775
1744 1948
1314 797
1661 1829
615 388
1255 1637
342 786
1570 1660...

output:

4002000

result:

ok 1 number(s): "4002000"

Test #10:

score: 0
Accepted
time: 283ms
memory: 67112kb

input:

2000 2000 287243298
1752 1489
858 282
376 1815
759 1650
1276 593
345 1120
16 1441
8 873
156 1309
243 836
1388 668
1869 797
1214 393
1548 924
1325 598
676 13
55 1349
231 1039
1019 218
1559 1453
1394 1915
840 106
48 657
1851 1714
1492 1635
1978 1161
508 1156
340 674
23 1099
1331 1698
6 1948
32 74
1087...

output:

94479461

result:

ok 1 number(s): "94479461"

Test #11:

score: 0
Accepted
time: 263ms
memory: 67008kb

input:

2000 2000 378389500
1681 409
1700 100
1635 1926
1898 853
832 1311
61 352
349 236
1813 1541
329 427
322 1799
457 606
1882 1404
452 622
1130 882
1029 1842
1836 144
121 1451
555 1482
877 1573
891 923
43 1169
69 1742
1498 1909
201 963
1241 681
26 643
1930 1849
947 1887
1323 914
1362 563
268 470
1105 178...

output:

863383073

result:

ok 1 number(s): "863383073"

Test #12:

score: 0
Accepted
time: 135ms
memory: 35108kb

input:

2000 4000 265615405
1330 497
1227 245
301 827
575 59
201 645
1046 1510
1733 477
932 1987
1707 1745
1606 1732
991 1213
1387 958
1089 804
8 735
982 296
1874 1598
229 69
342 393
1052 248
105 1685
1335 872
688 60
1176 12
786 1299
506 467
1208 1425
1431 1110
592 471
1679 1619
684 1142
1306 78
829 1171
10...

output:

0

result:

ok 1 number(s): "0"

Test #13:

score: 0
Accepted
time: 168ms
memory: 35124kb

input:

2000 4000 793117996
1428 458
158 1699
894 781
332 153
1806 1410
481 87
1909 225
1629 916
253 635
202 1022
1258 1480
611 1910
119 1147
807 140
1216 1382
301 559
1550 402
1168 1708
1976 688
938 1762
375 1391
1412 1660
536 1139
762 1888
959 693
468 1538
415 1604
920 1472
1899 1843
1101 1572
654 163
296...

output:

0

result:

ok 1 number(s): "0"

Test #14:

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

input:

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

output:

12

result:

ok 1 number(s): "12"

Test #15:

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

input:

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

output:

486

result:

ok 1 number(s): "486"

Test #16:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #17:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #18:

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

input:

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

output:

366502

result:

ok 1 number(s): "366502"

Test #19:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #20:

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

input:

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

output:

189744

result:

ok 1 number(s): "189744"

Test #21:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #22:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #23:

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

input:

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

output:

3120

result:

ok 1 number(s): "3120"

Test #24:

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

input:

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

output:

2284

result:

ok 1 number(s): "2284"

Test #25:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #26:

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

input:

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

output:

9659

result:

ok 1 number(s): "9659"

Test #27:

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

input:

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

output:

5123

result:

ok 1 number(s): "5123"

Test #28:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #29:

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

input:

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

output:

151851

result:

ok 1 number(s): "151851"

Test #30:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #31:

score: 0
Accepted
time: 198ms
memory: 44492kb

input:

2000 4000 1000000000
232 1886
388 290
1293 94
1281 160
630 183
905 1715
540 1093
1940 162
1523 1187
49 1881
242 561
1277 208
1658 1742
968 9
1180 1957
394 425
1969 326
1492 1138
1928 1981
1120 704
105 1361
1006 1065
684 596
1007 779
1969 520
1396 598
933 578
1238 846
412 38
245 1297
729 1284
951 146...

output:

349457480

result:

ok 1 number(s): "349457480"

Test #32:

score: 0
Accepted
time: 130ms
memory: 40160kb

input:

2000 4000 1000000000
1885 81
770 520
1107 45
1145 1701
1551 89
1507 1679
250 1114
768 280
1584 808
398 991
1303 1028
1697 335
432 116
1831 1850
1231 694
1212 1359
1997 1285
659 1286
1177 214
12 1287
652 1826
439 700
485 517
1912 1526
1902 1613
504 1956
222 682
166 728
357 1402
2 177
1694 1564
895 51...

output:

769493397

result:

ok 1 number(s): "769493397"

Test #33:

score: 0
Accepted
time: 122ms
memory: 35696kb

input:

2000 4000 1000000000
1435 685
761 1702
1074 1853
250 951
222 606
1140 1782
1435 494
696 1067
1106 1200
1616 912
1732 607
1499 923
1067 1231
1876 127
1286 538
915 517
127 1916
202 1001
927 152
1732 1392
292 1496
689 1831
1330 538
1933 1115
1109 1654
889 53
1141 951
410 790
93 713
880 879
291 1848
245...

output:

699976157

result:

ok 1 number(s): "699976157"

Test #34:

score: 0
Accepted
time: 123ms
memory: 35772kb

input:

2000 4000 1000000000
1546 929
161 272
30 294
1588 130
308 1961
1379 692
1954 650
701 862
758 801
327 458
755 1074
141 1893
1450 117
876 40
1985 274
399 20
978 884
984 366
8 1740
200 78
1041 862
970 1404
1650 1495
1032 1294
402 344
1915 1400
1271 1833
1954 252
308 390
1966 908
810 1397
405 659
1020 9...

output:

846159205

result:

ok 1 number(s): "846159205"

Test #35:

score: 0
Accepted
time: 118ms
memory: 35624kb

input:

2000 4000 1000000000
681 650
474 846
1267 1624
1724 892
1467 728
92 1738
1986 681
1104 1719
1354 1869
66 721
1792 1108
8 1449
1234 980
425 643
694 1617
1316 709
1088 1131
1331 794
966 1497
1891 544
998 1563
924 1805
367 864
850 1244
1341 1226
540 834
268 1841
1178 612
19 596
1900 266
1004 695
104 16...

output:

708742477

result:

ok 1 number(s): "708742477"

Test #36:

score: 0
Accepted
time: 163ms
memory: 35668kb

input:

2000 4000 1000000000
1906 1705
1484 1192
277 704
1964 1909
1609 143
128 1935
289 970
1990 1055
1322 1684
516 1504
1692 150
468 292
219 1102
458 1738
107 1803
481 11
1912 1823
194 22
878 1134
1924 933
1765 477
747 350
850 91
1413 1775
551 999
1684 1714
1436 117
1905 775
334 809
1771 382
403 400
1589 ...

output:

819325947

result:

ok 1 number(s): "819325947"

Test #37:

score: 0
Accepted
time: 142ms
memory: 35720kb

input:

2000 4000 1000000000
878 999
1913 1119
116 762
543 1358
1441 469
93 1339
1108 1040
1067 1436
1572 314
480 1095
187 573
283 880
1163 1375
955 518
542 800
1756 1793
1673 1911
1827 1190
51 652
801 1378
97 1882
222 1257
273 278
1068 1584
1945 299
1496 1411
785 1692
1883 1809
1329 697
580 223
1410 1104
1...

output:

55243977

result:

ok 1 number(s): "55243977"

Test #38:

score: 0
Accepted
time: 203ms
memory: 35556kb

input:

2000 4000 1000000000
588 1824
1811 1728
1992 1925
1136 1343
1061 623
502 533
192 1450
1828 1499
94 1916
1624 1831
1586 816
1157 1686
1781 164
1685 995
17 657
1059 498
1302 1714
25 152
989 1739
719 1848
1658 1003
1731 1001
1749 318
351 1934
671 30
357 1598
1108 507
1724 316
394 937
1775 1412
170 1725...

output:

5546248

result:

ok 1 number(s): "5546248"

Test #39:

score: 0
Accepted
time: 152ms
memory: 35668kb

input:

2000 4000 1000000000
92 1647
437 1320
603 1170
997 131
77 1200
1000 159
698 195
1044 256
913 795
1373 860
1406 1249
57 1895
1128 816
1785 1743
2000 1341
1610 840
574 1180
860 1554
1166 449
1832 108
1196 1010
526 684
378 170
443 1897
907 1485
1148 1831
1114 720
23 571
581 1560
671 1429
483 1454
666 4...

output:

888581794

result:

ok 1 number(s): "888581794"

Test #40:

score: 0
Accepted
time: 110ms
memory: 35732kb

input:

2000 4000 1000000000
1453 1777
1957 456
783 415
1116 1293
747 750
1483 1556
1915 897
446 290
933 583
379 495
1802 181
1599 1275
511 1121
92 881
1187 493
1030 1135
562 649
1713 52
961 803
1479 1923
1425 1292
1710 1638
1309 1566
463 1477
1381 1308
334 142
814 1099
1504 554
1483 1817
55 1009
1626 1380
...

output:

598700376

result:

ok 1 number(s): "598700376"

Test #41:

score: 0
Accepted
time: 123ms
memory: 35724kb

input:

2000 4000 304779265
1305 1476
1964 1819
1968 885
1026 1780
1274 1359
1014 1571
253 1931
1426 27
700 1973
1648 930
186 972
288 861
197 272
1231 633
1983 1793
1315 696
1708 783
1028 1403
201 321
1837 1382
838 270
1194 670
1264 977
561 965
1528 594
1077 1444
400 499
1009 878
125 1549
1510 1965
889 1416...

output:

136974666

result:

ok 1 number(s): "136974666"

Test #42:

score: 0
Accepted
time: 166ms
memory: 35620kb

input:

2000 4000 515640268
1087 1468
1779 1868
1824 310
1324 583
1911 1969
1089 1200
1311 337
215 1921
871 917
1204 1237
1476 621
627 578
235 1903
132 515
669 388
1653 909
1403 1769
1622 1068
1205 930
1809 1070
972 728
1721 1290
1479 292
1534 641
803 1368
828 1331
1766 991
1563 1417
1687 1609
987 700
1831 ...

output:

881624248

result:

ok 1 number(s): "881624248"

Test #43:

score: 0
Accepted
time: 185ms
memory: 39980kb

input:

2000 4000 1000000000
35 524
1911 1137
1268 189
458 110
762 277
732 989
1310 601
599 1792
229 204
1968 1822
1027 937
876 1346
464 697
764 1258
159 1034
707 645
1302 1647
1046 1264
1306 1576
1429 1308
836 842
1441 1682
548 404
329 1694
891 1354
1289 29
1118 1346
1915 1601
1257 768
831 635
1582 1655
92...

output:

298980259

result:

ok 1 number(s): "298980259"

Test #44:

score: 0
Accepted
time: 136ms
memory: 35640kb

input:

2000 4000 1000000000
1785 1029
1590 620
189 1988
890 1727
236 945
1161 336
350 1916
1292 1574
608 457
731 1104
1120 475
339 654
133 1878
1564 214
809 51
1187 1142
1584 811
27 1565
1996 1977
1289 405
1372 1585
1673 132
16 206
437 910
1287 35
1869 1565
655 1605
1424 818
185 1033
1475 692
1831 882
1324...

output:

948619585

result:

ok 1 number(s): "948619585"

Test #45:

score: 0
Accepted
time: 133ms
memory: 37836kb

input:

2000 4000 1000000000
951 1127
165 1333
1472 992
627 786
332 441
1564 1025
1421 754
1237 1959
692 1641
170 1065
604 1847
670 573
1750 503
1917 644
288 1411
1790 1151
1307 1747
1049 1804
1235 733
1735 457
1323 1565
1366 779
366 350
934 1941
405 1793
243 1737
338 305
396 807
1779 860
883 1708
1101 319
...

output:

573525954

result:

ok 1 number(s): "573525954"

Test #46:

score: 0
Accepted
time: 134ms
memory: 35720kb

input:

2000 4000 1000000000
1193 1326
1182 406
1869 1986
1031 1355
1630 568
1869 1044
695 1892
245 1077
380 630
1930 1558
325 1790
45 1651
615 943
1715 233
1847 1464
1170 1095
1405 1479
1357 413
961 194
1603 153
1982 432
1525 858
394 46
718 54
1622 662
1719 883
769 300
918 344
1248 1137
571 969
1395 1708
5...

output:

421048588

result:

ok 1 number(s): "421048588"

Test #47:

score: 0
Accepted
time: 190ms
memory: 35544kb

input:

2000 4000 1000000000
707 1437
159 1289
1877 1126
328 1120
33 481
741 739
1416 65
986 1880
1516 1865
784 1688
1098 1264
278 1541
234 1248
599 659
1718 889
249 967
1388 451
1881 1487
1050 1013
1515 316
726 585
108 384
389 1154
1784 1525
483 776
617 889
1669 407
1076 1529
1386 1387
1387 964
1509 1689
1...

output:

967582858

result:

ok 1 number(s): "967582858"

Test #48:

score: 0
Accepted
time: 208ms
memory: 35688kb

input:

2000 4000 1000000000
1121 239
460 751
336 18
611 1589
1894 1122
416 1939
532 291
183 215
1107 1285
328 1096
505 1172
1074 1203
577 172
671 713
790 100
1404 199
303 587
1808 105
1641 1316
1789 1957
1208 1600
931 1037
1365 249
580 1269
786 1372
1785 1701
1420 1307
819 1305
710 1387
1293 1409
941 1325
...

output:

169500953

result:

ok 1 number(s): "169500953"

Test #49:

score: 0
Accepted
time: 193ms
memory: 35660kb

input:

2000 4000 1000000000
1315 1748
1213 1759
1836 925
898 572
1298 601
347 810
411 389
410 1465
1293 885
929 552
612 731
206 132
1516 1675
1551 1498
477 434
41 253
631 650
882 1475
1213 529
1865 811
1030 469
385 475
1206 123
150 1004
976 456
495 157
592 1358
1255 1584
1207 344
1076 1236
1037 726
565 566...

output:

17628883

result:

ok 1 number(s): "17628883"

Test #50:

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

input:

4 4 10
1 2
2 1
3 4
4 3

output:

2888

result:

ok 1 number(s): "2888"

Test #51:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #52:

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

input:

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

output:

63664

result:

ok 1 number(s): "63664"

Test #53:

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

input:

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

output:

174870

result:

ok 1 number(s): "174870"

Test #54:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #55:

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

input:

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

output:

189744

result:

ok 1 number(s): "189744"

Test #56:

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

input:

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

output:

2634

result:

ok 1 number(s): "2634"

Test #57:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #58:

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

input:

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

output:

923489

result:

ok 1 number(s): "923489"

Test #59:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #60:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #61:

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

input:

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

output:

1977

result:

ok 1 number(s): "1977"

Test #62:

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

input:

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

output:

2970

result:

ok 1 number(s): "2970"

Test #63:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #64:

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

input:

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

output:

10208

result:

ok 1 number(s): "10208"

Test #65:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #66:

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

input:

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

output:

42384

result:

ok 1 number(s): "42384"

Test #67:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #68:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #69:

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

input:

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

output:

189744

result:

ok 1 number(s): "189744"

Test #70:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #71:

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

input:

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

output:

6

result:

ok 1 number(s): "6"

Test #72:

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

input:

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

output:

12112

result:

ok 1 number(s): "12112"

Test #73:

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

input:

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

output:

5879

result:

ok 1 number(s): "5879"

Test #74:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #75:

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

input:

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

output:

435451

result:

ok 1 number(s): "435451"

Test #76:

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

input:

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

output:

1274

result:

ok 1 number(s): "1274"

Test #77:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #78:

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

input:

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

output:

366502

result:

ok 1 number(s): "366502"

Test #79:

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

input:

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

output:

468

result:

ok 1 number(s): "468"

Test #80:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #81:

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

input:

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

output:

8

result:

ok 1 number(s): "8"

Test #82:

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

input:

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

output:

94

result:

ok 1 number(s): "94"

Test #83:

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

input:

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

output:

12112

result:

ok 1 number(s): "12112"

Test #84:

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

input:

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

output:

7091

result:

ok 1 number(s): "7091"

Test #85:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #86:

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

input:

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

output:

10941

result:

ok 1 number(s): "10941"

Test #87:

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

input:

8 11 4
1 4
4 1
3 6
6 3
1 3
7 5
5 7
1 7
8 2
2 8
3 8

output:

15680

result:

ok 1 number(s): "15680"

Test #88:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #89:

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

input:

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

output:

266979

result:

ok 1 number(s): "266979"

Test #90:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #91:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #92:

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

input:

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

output:

46

result:

ok 1 number(s): "46"

Test #93:

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

input:

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

output:

30

result:

ok 1 number(s): "30"

Test #94:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #95:

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

input:

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

output:

34011

result:

ok 1 number(s): "34011"

Test #96:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #97:

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

input:

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

output:

72

result:

ok 1 number(s): "72"

Test #98:

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

input:

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

output:

28206

result:

ok 1 number(s): "28206"

Test #99:

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

input:

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

output:

1782

result:

ok 1 number(s): "1782"

Test #100:

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

input:

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

output:

89040

result:

ok 1 number(s): "89040"

Test #101:

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

input:

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

output:

113520

result:

ok 1 number(s): "113520"

Test #102:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #103:

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

input:

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

output:

189744

result:

ok 1 number(s): "189744"

Test #104:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #105:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #106:

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

input:

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

output:

10

result:

ok 1 number(s): "10"

Test #107:

score: 0
Accepted
time: 272ms
memory: 48580kb

input:

2000 4000 1000000000
900 1373
1468 126
307 1106
901 505
1675 1397
320 1823
350 840
1108 1387
1927 1792
511 155
42 1863
1020 1755
874 1987
1145 962
1178 701
58 1703
1391 867
1111 918
1105 1789
417 1086
1409 1336
1449 1426
855 1062
476 284
1557 1605
1584 262
780 1921
73 218
1679 318
175 748
299 1207
7...

output:

853186463

result:

ok 1 number(s): "853186463"

Test #108:

score: 0
Accepted
time: 290ms
memory: 48104kb

input:

2000 4000 1000000000
1763 428
315 1075
932 1579
1192 1060
167 819
1705 479
1506 1264
335 394
519 899
664 1625
970 1773
393 171
1464 732
120 739
294 1221
512 1897
1874 745
97 27
1591 1324
1939 1189
391 175
850 1399
723 999
1100 1083
1205 1571
443 1616
1226 703
1072 1640
1886 952
1242 1758
595 205
472...

output:

423922928

result:

ok 1 number(s): "423922928"

Test #109:

score: 0
Accepted
time: 302ms
memory: 46448kb

input:

2000 4000 1000000000
604 815
1221 1791
1357 1648
54 303
126 1098
567 684
407 1481
1075 1878
457 1129
1792 477
919 211
709 2000
1856 925
1610 1593
1058 490
727 1105
1602 1666
944 876
836 1795
130 821
1863 1846
1009 793
981 1576
1236 1114
1956 1299
674 1245
1410 760
1130 1733
811 71
1593 1134
1728 171...

output:

500671104

result:

ok 1 number(s): "500671104"

Test #110:

score: 0
Accepted
time: 272ms
memory: 46336kb

input:

2000 4000 1000000000
821 1863
1436 84
446 1490
1884 1892
1771 975
1899 254
698 1695
708 828
81 1922
1322 1801
1528 1130
139 1280
1770 366
299 189
639 1038
1493 1649
264 398
563 663
78 215
1678 1912
1855 1682
795 838
436 150
1201 85
473 1699
1813 1352
358 1348
1675 503
220 1516
315 1323
1267 1207
143...

output:

920416965

result:

ok 1 number(s): "920416965"

Test #111:

score: 0
Accepted
time: 267ms
memory: 46544kb

input:

2000 4000 1000000000
744 1246
1578 669
873 1598
111 1184
220 254
1883 1385
1403 227
1243 1439
1978 145
1660 1682
1956 186
759 1766
1304 135
1576 1554
1070 1023
1839 1065
1704 578
478 384
1615 1120
1906 1436
1027 1236
45 1513
1012 1129
842 1555
389 1508
1970 85
631 630
742 1050
1233 250
1710 1017
101...

output:

870919519

result:

ok 1 number(s): "870919519"

Test #112:

score: 0
Accepted
time: 262ms
memory: 47936kb

input:

2000 4000 1000000000
178 185
1279 1222
635 975
469 171
1897 914
454 496
57 432
273 652
522 1605
455 533
679 828
190 1024
1194 1150
1582 217
1300 1754
426 726
1360 528
210 666
238 1874
1407 638
606 82
1249 573
1709 165
1537 753
1135 62
1774 1953
220 1476
243 1712
1605 215
736 1706
1304 1005
1364 1529...

output:

638873061

result:

ok 1 number(s): "638873061"

Test #113:

score: 0
Accepted
time: 274ms
memory: 47092kb

input:

2000 4000 1000000000
1724 1823
1454 1931
1983 39
1563 1650
633 160
1967 1702
191 590
1238 1797
950 1876
368 211
1786 1263
694 1310
1890 143
1605 223
234 1110
1783 120
26 1313
1475 1846
1805 1616
1980 909
1355 432
1548 83
394 833
745 116
436 623
1634 1074
963 1100
1396 625
63 1648
202 1290
1333 1925
...

output:

290200921

result:

ok 1 number(s): "290200921"

Test #114:

score: 0
Accepted
time: 299ms
memory: 46204kb

input:

2000 4000 1000000000
410 965
1970 295
884 1145
1173 1175
1565 721
1477 437
10 717
423 1609
893 492
1529 793
1725 1090
1295 1831
1396 161
873 642
1401 1278
902 1066
1020 60
506 763
493 145
644 965
1974 629
1929 1474
735 1044
1081 1911
1871 1055
72 1765
1277 286
1916 659
244 522
1790 1852
184 960
640 ...

output:

535017763

result:

ok 1 number(s): "535017763"

Test #115:

score: 0
Accepted
time: 265ms
memory: 46308kb

input:

2000 4000 1000000000
128 712
1446 1356
1036 430
418 1964
180 1597
127 1912
1062 150
483 478
619 42
1715 1930
1427 173
1848 303
202 1436
942 580
192 1076
490 940
1081 1564
501 755
982 1780
1168 994
27 367
1126 1592
1722 605
556 1016
266 196
157 45
246 1679
1687 1160
1926 779
1661 865
18 259
1034 371
...

output:

384765568

result:

ok 1 number(s): "384765568"

Test #116:

score: 0
Accepted
time: 256ms
memory: 46800kb

input:

2000 4000 1000000000
1799 561
1284 1431
513 515
1757 234
195 1375
703 1992
546 1001
445 850
716 812
1959 1848
859 808
1599 753
1957 404
812 1756
361 1769
815 1234
907 1408
1651 1964
1831 1411
4 1866
1014 1033
1495 1877
1532 1254
1373 1490
882 854
1967 1211
438 1580
393 306
1427 1186
964 163
1084 192...

output:

686102502

result:

ok 1 number(s): "686102502"

Test #117:

score: 0
Accepted
time: 229ms
memory: 44160kb

input:

2000 4000 1000000000
1859 1421
775 241
1851 262
1809 336
1910 520
192 1258
1396 152
1457 1561
171 621
155 1183
163 38
615 667
1177 776
1597 1231
1878 1633
1460 1704
1760 616
839 609
957 1728
1900 1865
1306 706
1970 1875
191 1390
1069 1724
1458 1880
203 295
1917 663
1889 600
252 475
1118 709
287 124
...

output:

466212992

result:

ok 1 number(s): "466212992"

Test #118:

score: 0
Accepted
time: 236ms
memory: 43808kb

input:

2000 4000 1000000000
7 145
582 1054
1240 298
1526 1368
1447 758
851 1131
270 258
672 788
516 594
1403 910
20 303
783 15
579 411
1696 1142
1944 1158
507 1689
1168 1025
1455 1903
5 1495
1730 1839
1779 1948
890 1985
1688 1668
1571 321
1633 241
1081 1861
630 1352
354 1544
704 1131
329 541
848 1850
1356 ...

output:

968846340

result:

ok 1 number(s): "968846340"

Test #119:

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

input:

8 12 100
5 6
6 5
1 2
2 3
3 4
4 1
1 6
3 6
7 8
8 7
7 2
8 4

output:

991039887

result:

ok 1 number(s): "991039887"

Test #120:

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

input:

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

output:

72030

result:

ok 1 number(s): "72030"

Test #121:

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

input:

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

output:

76832

result:

ok 1 number(s): "76832"

Test #122:

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

input:

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

output:

72030

result:

ok 1 number(s): "72030"

Test #123:

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

input:

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

output:

72030

result:

ok 1 number(s): "72030"

Test #124:

score: 0
Accepted
time: 104ms
memory: 46912kb

input:

2000 2001 1000000000
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...

output:

762205290

result:

ok 1 number(s): "762205290"

Test #125:

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

input:

1 0 0

output:

0

result:

ok 1 number(s): "0"

Test #126:

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

input:

1 0 1

output:

2

result:

ok 1 number(s): "2"