QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#93423#265. 正则二分图匹配chenshi#100 ✓2720ms138620kbC++629b2023-03-31 20:25:092023-03-31 20:25:12

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-31 20:25:12]
  • 评测
  • 测评结果:100
  • 用时:2720ms
  • 内存:138620kb
  • [2023-03-31 20:25:09]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int o=2e6+10;
int n,d,p[o],st[o],tp,ptnl[o],ptnr[o];bool vis[o];vector<int> e[o];mt19937 rnd(time(0));
int main(){
	scanf("%d%d",&n,&d);
	for(int i=1;i<=n;p[i]=i,++i) for(int j=d,u;j--;) scanf("%d",&u),e[i].push_back(u);
	shuffle(p+1,p+n+1,rnd);
	for(int i=1;i<=n;++i){
		for(int j=p[i],k;j;vis[st[++tp]=k]=1,j=ptnr[k]){
			do k=e[j][rnd()%d];while(k==ptnl[j]);
			for(;vis[k];vis[st[tp--]]=0);
		}
		for(;tp;vis[st[tp--]]=0) ptnl[ptnr[st[tp]]=ptnr[st[tp-1]]]=st[tp];
		ptnr[ptnl[p[i]]=st[1]]=p[i];
	}
	for(int i=1;i<=n;++i) printf("%d ",ptnl[i]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 3.0303
Accepted
time: 89ms
memory: 59536kb

input:

200000 1
4860
68405
196988
88061
63179
145556
153543
137408
73529
98133
121426
169157
139971
30468
40561
61417
2377
128946
78342
104898
53132
19812
6001
76501
144382
28176
104732
93137
81527
47685
16750
178443
30278
34394
36927
144836
113402
150495
198662
154016
49033
63788
118907
17990
25923
171718...

output:

4860 68405 196988 88061 63179 145556 153543 137408 73529 98133 121426 169157 139971 30468 40561 61417 2377 128946 78342 104898 53132 19812 6001 76501 144382 28176 104732 93137 81527 47685 16750 178443 30278 34394 36927 144836 113402 150495 198662 154016 49033 63788 118907 17990 25923 171718 199418 8...

result:

ok a perfect matching

Test #2:

score: 3.0303
Accepted
time: 163ms
memory: 55456kb

input:

100000 2
38701 64233
21385 98890
44018 45182
4039 81322
19092 98375
6549 69934
60546 82625
61820 88847
80625 98712
6227 9161
47457 91129
69077 71917
48385 81391
40048 85262
10964 28517
55941 72848
35865 43668
14735 97999
79332 90768
40710 94535
77099 85283
43429 80203
21562 48738
62878 80027
1251 44...

output:

38701 21385 44018 81322 19092 6549 60546 88847 80625 6227 47457 69077 48385 85262 10964 72848 35865 97999 79332 40710 85283 80203 21562 62878 44542 57810 77904 12003 80343 17143 9888 75542 37189 52865 7769 66178 52459 23769 5508 2035 78905 96606 14212 92309 60161 97360 84131 2831 25716 38120 20898 1...

result:

ok a perfect matching

Test #3:

score: 3.0303
Accepted
time: 75ms
memory: 53468kb

input:

66666 3
2865 7709 21957
3002 30528 66049
3259 33642 55999
27855 64335 65310
3379 7925 44323
21726 35131 35446
20806 52528 63257
6408 27039 50557
15771 37822 58917
29235 34506 64074
9789 11376 42730
6007 25251 46717
4858 28813 65939
10460 37494 38602
18356 26954 46940
20154 50645 56311
10095 17174 34...

output:

7709 3002 55999 64335 3379 35131 63257 6408 15771 34506 9789 46717 65939 38602 26954 50645 10095 52076 5195 36214 57776 46145 17925 65698 31863 27065 52130 64048 25501 27892 4713 36788 37938 18006 44265 36467 48870 41943 56397 35913 10873 20156 40790 34335 7122 35787 3448 24434 62477 61505 33786 493...

result:

ok a perfect matching

Test #4:

score: 3.0303
Accepted
time: 31ms
memory: 52384kb

input:

20000 10
4453 4938 7489 8143 8851 14086 15777 15856 19810 19994
1101 1589 3045 4999 7145 8862 10949 13906 14209 19253
813 936 1987 3395 4231 9971 10028 10087 13816 17859
295 1543 6587 10106 10944 11046 12258 14673 15335 16861
1299 1466 3906 4352 4908 5370 12314 15702 16937 18602
1625 1957 1971 4818 ...

output:

15856 1101 10028 12258 4908 1957 14665 13311 17883 8255 7237 5183 12430 12259 5685 13513 12379 10714 13072 3098 13761 10752 5850 9706 16022 7166 1178 5036 4896 11275 1542 17966 19194 15323 6546 14717 3297 3849 10404 10554 18245 10014 1374 6491 13694 5743 3411 14341 10104 16976 15567 2070 10527 1087 ...

result:

ok a perfect matching

Test #5:

score: 3.0303
Accepted
time: 32ms
memory: 52104kb

input:

10000 20
798 829 835 1016 1195 2218 3476 3501 3863 4059 4073 4687 6721 7114 7148 7348 8500 8532 8775 9158
541 778 816 1906 2526 2578 3326 3607 4160 4522 4820 6306 6687 6923 8549 8695 8985 9347 9553 9994
159 382 543 648 1201 1650 2562 3014 3235 3376 3505 3876 5740 6798 7148 7580 8320 8525 9424 9521
2...

output:

7114 6923 7148 2349 9027 3949 923 3523 4563 8424 2103 8275 3747 1200 3384 63 611 7228 3471 4900 2737 2104 8609 1751 9984 4070 2000 7561 8429 651 3158 2874 515 7356 8238 9356 1280 9609 5778 9393 9899 9176 6500 5251 856 7917 3201 493 3881 173 2726 30 5003 3769 8046 7950 967 5058 6309 5365 6720 7894 21...

result:

ok a perfect matching

Test #6:

score: 3.0303
Accepted
time: 20ms
memory: 51680kb

input:

4000 50
330 432 487 676 726 738 833 937 949 954 975 994 1032 1051 1099 1132 1183 1346 1547 1566 1617 1720 1721 1774 1803 1980 2193 2328 2350 2413 2426 2587 2691 2792 2976 3021 3066 3119 3171 3477 3484 3533 3577 3605 3618 3731 3803 3874 3918 3994
28 75 214 265 313 319 335 366 403 556 714 804 924 938 ...

output:

1032 938 3733 2101 977 1483 1508 1801 1931 218 2011 1688 2535 2369 2423 259 2427 1560 1328 1090 3367 444 911 1181 1460 3568 142 3316 2031 2785 902 1409 2093 1739 248 2448 300 3522 3365 1457 1142 1342 3054 783 3 2984 3446 888 359 2912 1029 478 1625 2495 274 341 2331 1479 3408 2086 2999 2036 2048 1584...

result:

ok a perfect matching

Test #7:

score: 3.0303
Accepted
time: 29ms
memory: 51612kb

input:

2000 100
4 12 54 56 69 85 113 123 128 183 207 209 212 212 247 249 310 330 347 377 403 409 421 435 484 500 504 526 540 556 571 578 589 648 648 694 727 732 732 790 797 838 871 880 889 950 973 1018 1018 1025 1063 1109 1116 1145 1197 1230 1239 1258 1266 1268 1284 1304 1307 1376 1383 1386 1395 1404 1412 ...

output:

1018 1242 1932 1616 1267 1405 249 1613 1210 909 1412 1413 353 55 540 1011 1678 1479 245 925 335 138 1230 1196 554 1292 242 1554 109 1727 936 1136 1910 1231 35 703 1418 349 404 1073 769 1625 1271 877 1055 438 504 219 286 1650 1172 350 1459 1529 1330 1907 369 1096 1856 1527 1237 433 1095 157 831 255 4...

result:

ok a perfect matching

Test #8:

score: 3.0303
Accepted
time: 19ms
memory: 51604kb

input:

1000 200
3 9 11 14 28 33 35 38 44 63 74 83 83 95 100 104 106 106 109 118 128 131 132 132 140 142 143 144 145 145 145 149 150 155 161 166 167 172 173 174 174 175 183 190 194 198 201 201 203 203 204 215 217 223 225 242 248 258 267 269 272 272 275 278 281 293 297 299 318 320 334 339 343 344 344 347 348...

output:

806 793 654 856 829 766 118 533 611 516 174 221 65 192 637 583 379 952 353 789 331 108 476 845 802 639 241 692 668 949 41 688 576 452 569 670 119 635 364 591 890 343 951 724 182 27 102 986 632 726 641 893 105 731 156 205 49 891 809 544 1000 992 710 815 16 880 943 363 621 332 663 501 810 874 39 884 9...

result:

ok a perfect matching

Test #9:

score: 3.0303
Accepted
time: 24ms
memory: 52052kb

input:

666 300
1 1 5 5 11 13 13 14 19 23 25 25 25 28 31 31 31 34 36 36 37 41 44 44 45 46 52 54 55 57 58 59 61 62 65 66 67 68 71 72 75 81 81 83 84 84 87 90 92 93 93 94 95 99 99 101 103 103 105 115 115 116 117 117 120 120 123 126 131 131 136 137 142 144 151 152 161 161 162 167 169 169 169 173 177 178 184 188...

output:

44 141 102 527 2 362 236 559 98 355 394 56 47 109 646 145 53 558 361 297 73 24 120 142 351 598 606 388 309 424 58 70 599 207 208 82 643 380 640 55 568 116 327 508 151 244 375 233 139 413 600 214 63 649 545 386 340 409 493 171 310 146 426 278 274 92 300 29 419 264 107 148 301 199 518 179 256 350 352 ...

result:

ok a perfect matching

Test #10:

score: 3.0303
Accepted
time: 26ms
memory: 51156kb

input:

20 10000
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 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 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 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 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:

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

result:

ok a perfect matching

Test #11:

score: 3.0303
Accepted
time: 17ms
memory: 51036kb

input:

2 100000
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 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 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 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 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:

2 1 

result:

ok a perfect matching

Test #12:

score: 3.0303
Accepted
time: 21ms
memory: 50972kb

input:

1 200000
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 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 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 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 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 

result:

ok a perfect matching

Test #13:

score: 3.0303
Accepted
time: 1250ms
memory: 138620kb

input:

2000000 1
387507
1430778
218094
455064
807442
1582214
917699
1655968
1778462
772123
268962
996042
374054
1403419
1624814
36042
813077
1143919
1473390
817258
501378
1317855
1248063
1909613
1978084
1094998
60629
101651
272496
1610999
1051528
859247
300198
1994497
245332
761294
866191
549873
1162726
40...

output:

387507 1430778 218094 455064 807442 1582214 917699 1655968 1778462 772123 268962 996042 374054 1403419 1624814 36042 813077 1143919 1473390 817258 501378 1317855 1248063 1909613 1978084 1094998 60629 101651 272496 1610999 1051528 859247 300198 1994497 245332 761294 866191 549873 1162726 403056 39135...

result:

ok a perfect matching

Test #14:

score: 3.0303
Accepted
time: 2720ms
memory: 95188kb

input:

1000000 2
199363 754950
76613 628921
173375 900947
609231 802901
21413 217216
740983 755278
357523 781326
137929 439975
210831 550908
427758 764273
137762 254720
568822 871564
588642 836016
31686 707140
266427 566788
321499 905137
189618 726558
616699 630104
54080 766176
117957 586699
695703 987876
...

output:

199363 76613 900947 802901 217216 755278 357523 137929 550908 764273 137762 871564 588642 707140 566788 905137 189618 616699 54080 586699 695703 178663 977706 94468 840677 451100 227766 798274 660136 280560 138177 155987 749454 322629 736226 232092 398160 796647 66848 300748 137995 726017 248166 584...

result:

ok a perfect matching

Test #15:

score: 3.0303
Accepted
time: 1880ms
memory: 72612kb

input:

500000 4
38271 230013 254334 270640
41039 61228 344559 469434
263792 361339 441492 465652
55336 132032 276847 276901
14837 141419 213180 305018
165556 253636 256179 468748
49634 114442 197634 309934
26445 46027 179574 201044
141683 182112 384092 450681
260438 356066 389831 392443
247869 290124 41698...

output:

254334 41039 465652 276847 213180 253636 49634 201044 182112 356066 247869 382429 160039 293747 140596 368334 113288 323604 89978 186917 230363 473670 435471 161626 498607 408524 32429 36726 415559 55048 85438 141220 142095 325869 414682 430620 484531 73284 202093 58641 141981 385474 447977 79075 42...

result:

ok a perfect matching

Test #16:

score: 3.0303
Accepted
time: 940ms
memory: 65648kb

input:

250000 8
2631 146917 164090 180005 186384 187359 209401 239796
19897 50857 57851 99955 119125 130482 197939 211046
61602 69725 125661 151789 152333 170938 191567 244630
28250 88386 126306 156434 209401 213742 236654 239399
4661 8624 39270 85312 106345 123219 179670 231814
3378 4520 37957 90740 10263...

output:

164090 19897 69725 28250 123219 37957 88026 135533 115405 150731 68621 3958 170786 66272 182680 54852 78369 208444 70683 97233 27329 238410 191307 105953 116428 211276 36013 69801 190349 205400 113436 140000 187128 30205 76104 7397 149135 48196 9184 53285 225314 188041 65782 28545 241811 123872 7350...

result:

ok a perfect matching

Test #17:

score: 3.0303
Accepted
time: 486ms
memory: 61888kb

input:

125000 16
1740 2837 3454 4468 4752 8259 17820 35622 53227 59127 62189 70804 104178 107139 112956 115071
4672 4917 5273 8630 19872 29772 34538 45649 48808 70653 77894 79629 89198 91989 111456 112385
10180 31425 32554 33836 40036 42641 68031 69244 69346 89583 91384 91749 102500 118132 118521 120404
98...

output:

3454 89198 120404 110528 27708 75637 75521 27046 22774 82799 36156 116816 79156 34847 113061 106205 13251 48107 64847 84460 45342 66680 61008 17259 79151 12755 25532 5119 27792 119591 102480 41531 79464 22194 71989 100051 60494 82295 124372 22645 57144 87992 56621 106788 59478 2498 58184 2951 60584 ...

result:

ok a perfect matching

Test #18:

score: 3.0303
Accepted
time: 288ms
memory: 60212kb

input:

62500 32
3835 4069 6664 9493 9882 11044 12096 13503 17277 21165 21387 21724 22795 27921 28532 30505 31535 32452 33959 39348 40644 42723 43420 44352 46706 48636 52153 56846 58062 58696 59340 62159
270 3267 5060 9255 11830 12242 12358 12423 12466 14286 16368 17387 23582 23668 23942 24884 26776 31524 3...

output:

52153 23668 58816 56109 26236 59674 36284 47049 47888 8619 49188 25029 53908 8205 53468 31821 48684 39106 55006 2959 30078 25854 18157 6130 10906 45411 12057 43826 34671 38119 60230 40230 1874 47663 60900 28325 61171 58841 406 8522 21225 2311 6795 40834 61452 19960 49688 61819 34670 30818 2312 18243...

result:

ok a perfect matching

Test #19:

score: 3.0303
Accepted
time: 185ms
memory: 58740kb

input:

15625 128
51 164 216 257 339 348 735 949 1178 1284 1664 1680 1707 1781 1809 1887 2034 2323 2389 2460 2631 2889 3166 3213 3234 3270 3336 3337 3426 3430 3488 3622 3637 3764 3813 3873 3932 4215 4267 4299 4364 4501 4643 4786 5012 5030 5070 5085 5119 5187 5317 5400 5459 5730 5860 5917 6187 6410 6795 7233...

output:

13246 5470 4636 15045 15104 352 9728 15276 685 10107 12742 1505 12067 14267 12234 4094 9779 14722 9559 1267 2593 14615 8581 12915 4246 6322 11726 11644 2056 4802 15346 9895 10867 7786 15120 5906 7883 13065 9104 8576 6158 13192 7286 4122 13565 8893 347 3112 12916 2990 14772 3572 6611 15342 14471 4863...

result:

ok a perfect matching

Test #20:

score: 3.0303
Accepted
time: 152ms
memory: 58432kb

input:

1953 1024
1 2 4 6 8 8 9 13 15 15 17 27 31 32 34 35 35 37 38 40 40 42 45 49 50 51 52 57 61 62 63 64 67 69 70 73 79 82 82 83 86 90 91 92 94 100 101 106 106 107 109 111 113 114 116 116 118 120 120 125 127 132 140 147 148 148 153 156 158 159 159 163 165 165 168 169 169 170 170 171 172 173 174 175 176 17...

output:

1029 1307 1383 79 1730 1065 1390 1165 269 354 1489 1630 915 894 1399 464 991 287 40 1147 679 1341 357 867 1260 1885 487 1429 1907 182 1441 1067 59 1208 1288 1935 1177 674 899 1518 681 243 861 109 1242 305 1197 1443 652 1321 1720 28 544 965 1704 1312 1787 1694 381 1114 290 1273 1677 302 1872 1056 975...

result:

ok a perfect matching

Test #21:

score: 3.0303
Accepted
time: 131ms
memory: 58268kb

input:

244 8192
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 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5...

output:

116 113 150 196 30 181 171 47 14 43 203 204 81 142 173 180 143 73 25 65 161 136 27 220 241 94 163 82 70 75 193 231 51 191 185 12 199 88 244 41 71 212 217 34 62 103 195 80 54 201 31 134 240 50 115 125 38 154 177 215 210 208 55 101 184 176 137 183 97 227 79 235 226 138 243 155 92 219 124 229 158 120 1...

result:

ok a perfect matching

Test #22:

score: 3.0303
Accepted
time: 127ms
memory: 60028kb

input:

30 65536
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 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 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 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 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:

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

result:

ok a perfect matching

Test #23:

score: 3.0303
Accepted
time: 104ms
memory: 57356kb

input:

3 524288
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 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 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 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 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 3 2 

result:

ok a perfect matching

Test #24:

score: 3.0303
Accepted
time: 2057ms
memory: 79884kb

input:

666666 3
3206 64240 199437
251202 414004 479216
133162 349551 525296
267125 278228 385799
255071 266873 648864
203529 309604 516958
227388 593079 647002
98211 414478 512085
200513 287454 395398
81231 139438 488811
180775 408644 487195
74579 149392 515012
466358 589635 620337
159618 186366 345229
255...

output:

3206 479216 349551 385799 648864 516958 593079 98211 287454 139438 487195 149392 466358 345229 455975 203276 231281 85393 7842 501690 554887 647630 122992 202099 136399 381924 362598 406143 661006 201039 260268 90267 160239 57759 335284 345135 466198 3618 616163 544112 181409 405030 482006 158159 42...

result:

ok a perfect matching

Test #25:

score: 3.0303
Accepted
time: 675ms
memory: 68648kb

input:

200000 10
2798 8208 22730 66600 119481 122650 156801 175474 177550 185015
9474 33088 52512 58337 89617 108000 129764 138027 167767 186477
2825 26827 51804 54149 80285 86265 97887 107376 141558 147823
19363 43877 45893 65333 88598 97896 108948 116509 131339 153148
33060 35928 44747 76078 78934 99908 ...

output:

8208 186477 86265 131339 44747 109058 195456 63100 151284 185195 96771 94741 54544 89235 147973 193556 123356 107387 135952 165805 28444 8525 130732 83740 82944 46812 10574 162706 50438 117420 94377 82517 146 92523 32208 38729 57289 181665 86825 124589 142310 95035 94478 121202 148331 120262 81354 3...

result:

ok a perfect matching

Test #26:

score: 3.0303
Accepted
time: 416ms
memory: 65916kb

input:

100000 20
5397 8196 10191 10507 18634 28459 29340 32559 40283 40598 53734 65521 67349 68029 69345 71483 76269 82047 84895 88672
4462 14803 19562 24889 25953 28548 32601 34192 34507 38342 48801 54116 68838 73926 78615 79627 83981 88503 90442 93297
13394 25531 37640 43005 43893 48131 51275 52948 59539...

output:

5397 54116 25531 92791 54714 45532 94415 46353 77364 74541 40195 35232 45564 86397 21605 1770 4226 52592 60714 1266 53493 82422 37456 69412 32496 86226 69504 48018 68522 32359 44195 22034 17684 31991 6474 11525 78198 51901 61219 42930 8768 10853 39442 71857 1736 24987 13254 61969 34069 20032 13909 4...

result:

ok a perfect matching

Test #27:

score: 3.0303
Accepted
time: 234ms
memory: 61696kb

input:

40000 50
230 2074 4290 4458 5074 6272 7009 8092 9278 10651 11049 11356 11594 11916 14215 14942 15654 17392 18351 19069 19367 19408 20099 20658 20846 22407 23012 23933 25542 25551 25843 25941 27453 27611 28243 29369 30209 30972 31099 33489 33788 34810 34829 34849 36245 36571 37309 37983 38974 39485
1...

output:

23933 34693 14387 37221 865 13026 2882 8844 35755 17328 29130 34626 18538 605 38654 17919 32805 28229 34005 9917 38331 22772 10039 13805 9292 29546 18106 30874 26146 1647 5510 11992 39347 17019 251 19457 9887 36293 17244 12693 15719 36490 30458 27888 12684 35885 30703 17776 12898 23224 39251 31865 3...

result:

ok a perfect matching

Test #28:

score: 3.0303
Accepted
time: 194ms
memory: 61312kb

input:

20000 100
346 384 416 439 566 781 899 950 1359 1370 1969 2025 2031 2043 2510 2703 3581 3610 3956 3960 3987 4008 4035 4392 4409 4853 5049 5092 5101 5955 6051 6132 6184 6260 6463 6632 6725 6995 7298 8049 8324 8349 8720 9111 9137 9233 9328 9353 9366 9405 9427 9496 9571 9572 9588 9641 9780 9879 10102 10...

output:

9137 17337 9364 8786 14138 15156 1364 18380 15666 6248 1967 14770 11569 14060 18023 885 12520 14949 11147 11234 9458 19052 3127 13743 15972 15042 10002 5277 17838 15697 7058 15403 7388 13758 1494 9127 19284 19253 1424 9009 10034 3933 10321 19061 13014 8262 13947 16370 11003 16686 9906 4742 2088 585 ...

result:

ok a perfect matching

Test #29:

score: 3.0303
Accepted
time: 161ms
memory: 64140kb

input:

6666 300
16 22 93 102 144 171 192 203 255 266 282 288 363 364 371 371 379 394 409 477 495 497 500 515 654 696 706 718 789 797 810 816 826 826 827 833 844 854 911 913 933 980 982 1006 1055 1078 1087 1116 1130 1139 1178 1245 1266 1367 1386 1447 1463 1468 1472 1489 1492 1495 1502 1513 1519 1526 1527 15...

output:

6409 4189 3338 6138 1472 1331 1398 2421 4703 6279 3474 5920 1418 3300 2954 4127 3400 2815 4328 5234 58 4294 3802 1435 715 1256 2975 3828 4257 5306 5325 3949 4896 3875 1660 616 4720 4789 1028 5820 4414 5748 6233 800 1773 2988 4235 4390 5425 2835 6021 1410 394 547 4401 1061 6220 4152 1269 3150 5126 50...

result:

ok a perfect matching

Test #30:

score: 3.0303
Accepted
time: 174ms
memory: 58588kb

input:

2000 1000
2 3 6 14 17 20 23 23 25 25 28 30 32 32 34 36 38 39 40 41 41 42 42 48 52 52 53 54 54 54 56 60 60 60 61 61 66 67 67 68 70 72 80 83 85 86 87 89 89 90 90 91 92 95 96 98 105 108 109 110 110 113 114 116 118 119 122 124 127 130 131 132 133 134 134 135 143 147 149 152 154 156 161 163 163 165 165 1...

output:

292 237 1245 152 331 606 1024 556 789 37 883 1230 392 891 1180 110 1960 1869 1146 203 76 1030 1067 1826 1553 1445 341 1453 1361 410 1908 973 879 1753 1775 867 1696 67 657 242 1061 1895 1919 1071 324 1926 1103 1806 118 1229 1413 1922 424 92 537 1872 1243 1667 1145 1603 1508 399 1971 1601 1216 1316 90...

result:

ok a perfect matching

Test #31:

score: 3.0303
Accepted
time: 142ms
memory: 58036kb

input:

40 50000
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 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 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 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 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:

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

result:

ok a perfect matching

Test #32:

score: 3.0303
Accepted
time: 129ms
memory: 58956kb

input:

4 500000
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 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 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 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 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:

2 1 3 4 

result:

ok a perfect matching

Test #33:

score: 3.0303
Accepted
time: 132ms
memory: 58484kb

input:

1 2000000
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 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 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 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 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 

result:

ok a perfect matching