QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#91584#265. 正则二分图匹配zsj6315#100 ✓2763ms144248kbC++14844b2023-03-29 09:10:382023-03-29 09:10:39

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-29 09:10:39]
  • 评测
  • 测评结果:100
  • 用时:2763ms
  • 内存:144248kb
  • [2023-03-29 09:10:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define ull unsigned long long
#define ll long long
#define mod 998244353
#define N 2000005
int n,k,mc[N],ans[N],P[N];
int stk[N],ins[N],top;
vector<int> G[N];
mt19937 rd(mod);
int main(){
	scanf("%d%d",&n,&k);
	fr(i,1,n){
		fr(j,1,k){
			int x;
			scanf("%d",&x);
			G[i].push_back(x);
		}
	}
	fr(i,1,n)P[i]=i;
	for(int i=n;i;i--)swap(P[i],P[rd()%i+1]); 
	fr(j,1,n){
		int u=P[j];
		while(u){
			int v;
			do{v=G[u][rd()%k];}while(mc[v]==u);
			while(ins[v])ins[stk[top--]]=0;
			ins[stk[++top]=v]=1;
			u=mc[v];
		}
		while(top>1){
			int v=stk[top--];
			ins[v]=0;
			mc[v]=mc[stk[top]];
		}
		mc[stk[top]]=P[j];
		ins[stk[top--]]=0;
	}
	fr(i,1,n)ans[mc[i]]=i;
	fr(i,1,n)printf("%d ",ans[i]);puts("");
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 3.0303
Accepted
time: 84ms
memory: 59888kb

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: 118ms
memory: 57136kb

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: 70ms
memory: 53664kb

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:

2865 3002 33642 64335 3379 21726 20806 27039 37822 34506 11376 46717 4858 37494 26954 56311 10095 27246 1802 21328 57776 50927 17925 65698 31863 46800 52130 64048 25501 17388 11569 59567 37938 18006 40834 46125 17419 52012 63154 19284 10873 20156 40790 34335 28272 43328 3448 3746 38803 6160 12914 60...

result:

ok a perfect matching

Test #4:

score: 3.0303
Accepted
time: 38ms
memory: 52392kb

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:

7489 1589 813 1543 12314 13064 2770 14381 17338 8255 9401 931 12430 7548 16716 19277 5710 17823 11965 7622 6495 2848 18320 17068 7898 16635 1178 11399 8913 2625 4231 13866 9307 2664 16698 8785 19738 19442 17207 10554 17334 12731 2423 6861 9912 18200 14898 13530 13304 18444 17498 13830 6179 2253 8155...

result:

ok a perfect matching

Test #5:

score: 3.0303
Accepted
time: 37ms
memory: 52136kb

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:

3476 3326 8320 2349 6290 6604 5522 6999 7766 1423 1809 2832 7293 5103 356 4934 6748 6070 1944 7482 5954 7156 7145 5213 8443 8096 576 2579 8699 6739 1932 2874 4849 7081 4489 9130 9837 6790 8561 4684 1001 8479 6500 3242 7476 6688 9245 357 2679 9871 3302 503 5003 8158 828 4956 7100 397 1099 3037 5762 4...

result:

ok a perfect matching

Test #6:

score: 3.0303
Accepted
time: 22ms
memory: 51696kb

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:

2193 2806 3838 2459 2345 891 421 3740 1356 2910 3976 1515 3180 2799 3590 112 1048 1165 2540 897 2600 2660 1234 2562 3127 3144 30 1657 283 1110 902 3832 2718 992 2159 884 2555 2825 3730 2288 603 1938 3940 3041 2914 3346 471 1496 931 1575 1749 1320 3099 3822 881 3280 1211 2723 3582 1139 3878 3303 3604...

result:

ok a perfect matching

Test #7:

score: 3.0303
Accepted
time: 25ms
memory: 51520kb

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:

1666 1900 1870 1437 1987 616 1430 413 1492 1051 1954 1213 747 907 1444 693 1719 1455 155 265 895 1696 1899 735 175 562 1922 804 1457 34 630 1467 1045 1234 884 21 567 1091 713 1794 561 1252 1911 1926 1292 1287 848 218 40 1905 875 1268 831 1085 99 373 730 1701 407 422 603 1692 823 736 1364 1048 1009 5...

result:

ok a perfect matching

Test #8:

score: 3.0303
Accepted
time: 22ms
memory: 51788kb

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:

918 524 219 301 825 680 761 466 638 973 2 791 747 800 742 267 278 896 137 527 607 717 720 815 807 855 951 977 239 651 894 218 352 853 324 288 965 557 287 383 248 567 696 600 327 935 74 823 375 753 306 949 97 907 710 395 944 256 189 574 419 594 405 586 892 786 297 198 818 275 473 867 341 623 115 7 62...

result:

ok a perfect matching

Test #9:

score: 3.0303
Accepted
time: 25ms
memory: 51924kb

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:

502 587 95 498 458 23 8 377 32 613 102 153 193 304 266 437 560 120 598 326 262 575 204 589 113 588 418 621 419 328 661 81 460 261 157 165 53 149 248 417 190 272 477 108 28 70 480 154 352 631 65 184 485 96 148 433 4 545 624 62 611 363 52 76 504 422 447 585 523 30 74 139 145 238 617 206 251 127 288 65...

result:

ok a perfect matching

Test #10:

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

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:

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

result:

ok a perfect matching

Test #11:

score: 3.0303
Accepted
time: 22ms
memory: 51064kb

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: 16ms
memory: 51160kb

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: 1242ms
memory: 144248kb

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: 2763ms
memory: 98836kb

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:

754950 628921 173375 609231 21413 740983 357523 439975 550908 764273 137762 568822 588642 707140 566788 321499 726558 630104 766176 586699 987876 767528 973796 94468 38853 24371 91765 798274 81723 280560 294316 155987 749454 322629 938408 232092 83664 796647 66848 300748 137995 474009 63141 276683 8...

result:

ok a perfect matching

Test #15:

score: 3.0303
Accepted
time: 1915ms
memory: 73964kb

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:

270640 344559 441492 55336 213180 468748 309934 179574 384092 389831 423517 290882 191935 37814 6306 275595 65848 323604 27368 170604 255210 82134 183404 68995 498607 263970 105301 209468 200017 229004 85438 29385 203584 181407 466169 430620 97132 24973 100240 58641 283356 29643 447977 451720 371245...

result:

ok a perfect matching

Test #16:

score: 3.0303
Accepted
time: 973ms
memory: 66204kb

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:

239796 197939 61602 239399 231814 102634 88026 120649 41703 158058 136406 128774 170786 43549 172172 128428 177833 70703 29998 234216 7380 78932 201014 105953 214765 90018 53554 95303 190349 40221 94647 140000 151800 221140 191397 168977 933 131104 174285 246247 110338 170609 20212 164193 27629 4140...

result:

ok a perfect matching

Test #17:

score: 3.0303
Accepted
time: 494ms
memory: 62460kb

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:

2837 34538 69346 61634 71396 2221 76194 92988 100131 109018 77146 3368 57928 82360 85911 106205 95665 48107 64847 106632 45342 26429 11468 2762 91946 45470 25532 12445 89583 106510 106809 43798 88887 87368 100501 119705 10880 82731 104894 22645 40813 31300 124439 119156 239 81074 106636 20739 87480 ...

result:

ok a perfect matching

Test #18:

score: 3.0303
Accepted
time: 302ms
memory: 60232kb

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:

6664 12466 62210 12524 19588 34561 33827 24499 3131 53497 702 5567 46287 27535 17049 8767 9112 58309 31696 51724 13765 20216 57669 20282 20150 17919 55089 20566 61693 54668 33518 43554 15722 53474 61516 38669 25867 62232 29678 33024 20126 52532 7354 11037 43561 45725 40939 12859 38780 44332 6774 197...

result:

ok a perfect matching

Test #19:

score: 3.0303
Accepted
time: 179ms
memory: 59044kb

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:

13678 14182 13318 4362 4359 3977 7325 11646 5364 11546 12742 12298 11281 14418 14098 12256 4681 6966 2240 8127 10645 1124 8200 2773 8031 15285 11465 11828 12235 3674 8006 7929 2521 78 9552 6089 3892 9595 11257 14698 7912 6788 11053 11463 8455 6061 12170 13465 7125 9358 12909 1357 70 13549 11351 2512...

result:

ok a perfect matching

Test #20:

score: 3.0303
Accepted
time: 135ms
memory: 58392kb

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:

289 1570 727 864 1765 99 848 1598 976 1503 348 1215 1933 1770 55 756 1493 1530 328 776 1659 888 1317 1787 1015 720 570 1855 1309 1396 589 1108 474 876 578 1940 1824 8 592 453 875 1465 1101 526 1357 1701 997 277 174 491 340 1006 1541 141 1315 43 1685 1312 1044 590 1022 349 747 1852 925 24 541 2 1731 ...

result:

ok a perfect matching

Test #21:

score: 3.0303
Accepted
time: 134ms
memory: 58108kb

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:

196 39 191 33 97 130 221 26 190 203 101 156 3 151 11 49 125 50 140 173 212 28 124 100 141 106 138 142 171 128 155 65 219 217 236 104 228 72 41 241 19 122 47 166 48 83 69 109 231 189 197 135 67 187 188 147 172 126 51 224 24 27 76 210 214 148 200 74 29 205 167 175 182 6 154 206 113 8 85 16 134 169 131...

result:

ok a perfect matching

Test #22:

score: 3.0303
Accepted
time: 141ms
memory: 58140kb

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:

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

result:

ok a perfect matching

Test #23:

score: 3.0303
Accepted
time: 99ms
memory: 57256kb

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:

2 3 1 

result:

ok a perfect matching

Test #24:

score: 3.0303
Accepted
time: 2276ms
memory: 81888kb

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:

64240 414004 349551 267125 648864 309604 647002 512085 395398 81231 408644 515012 466358 186366 262678 281668 444322 85393 491616 501690 554887 647630 453716 75664 265475 381924 239426 271801 661006 521357 544380 90267 145895 228118 99465 234239 466198 88306 477197 108473 146184 501288 482006 158159...

result:

ok a perfect matching

Test #25:

score: 3.0303
Accepted
time: 834ms
memory: 69220kb

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:

22730 129764 86265 45893 44747 109058 162577 53585 195780 185195 64957 112182 103035 31921 64495 191769 162881 136320 80334 165805 128340 117752 29196 24627 82944 169090 67144 98820 79205 32402 94377 137467 141825 141659 21109 47677 13295 79896 175961 124589 90225 19925 196636 121202 151649 177594 1...

result:

ok a perfect matching

Test #26:

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

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:

76269 34192 87049 4557 43154 59240 12669 4356 80661 19652 71905 97348 56545 62969 43582 65428 88638 48385 58239 26468 65869 56674 9129 11055 37377 45030 82810 48018 22672 17950 50296 70860 14806 4510 59311 49090 47462 34042 88004 29715 65582 2909 76149 92476 97806 50280 98571 73242 40420 81773 32063...

result:

ok a perfect matching

Test #27:

score: 3.0303
Accepted
time: 241ms
memory: 62004kb

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:

14215 39974 22109 28652 20142 11804 1085 4973 31658 3924 1033 36474 4167 30831 35265 38090 11008 3886 23351 21333 28979 6796 16581 28795 39002 12831 7966 34667 36276 34265 641 21755 31908 14906 8411 36994 31284 24803 37633 9539 23442 31491 24340 5738 37502 13077 36104 29333 14495 11414 25808 4991 38...

result:

ok a perfect matching

Test #28:

score: 3.0303
Accepted
time: 173ms
memory: 61144kb

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:

10644 1597 13318 9012 15433 9862 17489 18104 17811 3899 15071 16317 11270 4146 16565 10401 8794 12787 4001 13021 15218 432 1743 15749 7039 17843 16801 3409 405 14141 11397 18575 18826 6228 14921 7481 4038 6548 11338 7531 3271 16471 12537 6068 12442 19117 10905 160 8143 10907 2384 814 5822 15781 1979...

result:

ok a perfect matching

Test #29:

score: 3.0303
Accepted
time: 150ms
memory: 64164kb

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:

515 67 5095 1368 4902 2206 79 1006 6060 3619 6063 2492 5548 5684 1082 2750 1883 5480 1028 330 854 538 816 5666 2625 676 6626 1472 1424 4088 5683 3266 1867 3850 1552 4346 70 1501 1189 3690 4709 1889 5389 2049 2661 1900 2307 5481 4594 1603 1444 3311 2522 1342 2703 3067 3644 2093 4503 1978 1611 5636 17...

result:

ok a perfect matching

Test #30:

score: 3.0303
Accepted
time: 160ms
memory: 58812kb

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:

289 152 409 787 632 1212 1183 248 1007 454 591 1006 198 1605 1553 721 1404 601 67 1152 597 1294 383 142 991 1543 1149 373 1612 646 1284 529 654 380 99 1964 1573 641 48 1601 911 1810 794 745 430 819 1144 446 1004 643 683 521 1933 1521 131 169 453 1276 1394 1365 408 362 1914 160 1106 968 1487 14 1571 ...

result:

ok a perfect matching

Test #31:

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

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:

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

result:

ok a perfect matching

Test #32:

score: 3.0303
Accepted
time: 134ms
memory: 58776kb

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: 58548kb

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