QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#481167#265. 正则二分图匹配Purslane#100 ✓1854ms253760kbC++141.1kb2024-07-16 21:03:542024-07-16 21:03:54

Judging History

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

  • [2024-07-16 21:03:54]
  • 评测
  • 测评结果:100
  • 用时:1854ms
  • 内存:253760kb
  • [2024-07-16 21:03:54]
  • 提交

answer

#include<bits/stdc++.h>
#define ffor(i,a,b) for(int i=(a);i<=(b);i++)
#define roff(i,a,b) for(int i=(a);i>=(b);i--)
using namespace std;
const int MAXN=2e6+10;
int n,d,id[MAXN],vis[MAXN],mtl[MAXN],mtr[MAXN];
vector<int> Gl[MAXN],Gr[MAXN]; 
int main() {
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>n>>d;
	ffor(i,1,n) ffor(j,1,d) {int u;cin>>u,Gl[i].push_back(u),Gr[u].push_back(i);}
	mt19937 rnd,myrand(time(NULL));
	ffor(i,1,n) id[i]=i;
	shuffle(id+1,id+n+1,rnd);
	ffor(i,1,n) {
		int u=id[i];
		if(mtl[u]) continue ;
		stack<pair<int,int>> st;
		st.push({u,0});
		while(1) {
			int tr=0;
			while(1) {
				int id=myrand()%d;
				if(mtl[u]!=Gl[u][id]) {tr=Gl[u][id];break ;}
			}
			while(vis[tr]) {
				int u=st.top().first,id=st.top().second;	
				if(id) vis[u]=0;
				st.pop(); 
			}
			vis[tr]=1,st.push({tr,1});
			if(!mtr[tr]) break ;
			else u=mtr[tr],st.push({u,0});
			
		}
		while(!st.empty()) {
			int r=st.top().first; st.pop();
			int l=st.top().first; st.pop();
			mtl[l]=r,mtr[r]=l;
			vis[r]=0;	
		}
	}
	ffor(i,1,n) cout<<mtl[i]<<' ';
	return 0;
}

詳細信息

Test #1:

score: 3.0303
Accepted
time: 100ms
memory: 116936kb

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: 81ms
memory: 107716kb

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:

64233 98890 45182 4039 98375 69934 82625 61820 98712 9161 91129 71917 81391 40048 28517 55941 43668 14735 90768 94535 77099 43429 48738 80027 1251 95683 3554 82308 74040 41400 48086 62117 40713 28633 1726 12755 36642 84843 96458 31819 12260 77366 78075 81570 68967 67263 43515 96170 90595 96142 38284...

result:

ok a perfect matching

Test #3:

score: 3.0303
Accepted
time: 77ms
memory: 106160kb

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:

21957 66049 3259 27855 44323 35131 20806 27039 37822 64074 11376 6007 28813 38602 18356 56311 17174 62088 1802 12848 57776 46145 17925 47027 31863 34209 47712 34086 25501 27892 11569 36788 52942 24055 52273 46125 48870 66265 18633 19284 12216 20156 28138 25549 7122 6746 28826 33808 43681 6160 24902 ...

result:

ok a perfect matching

Test #4:

score: 3.0303
Accepted
time: 36ms
memory: 104904kb

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:

8143 4999 936 10106 4352 6369 2770 13554 9955 8255 5215 17944 5884 17044 12606 13777 5710 9502 18085 11107 8316 2848 18320 8618 13282 7166 15825 7596 15531 12064 13402 17966 13077 6990 1928 8948 2505 17733 10404 452 7885 10014 2423 6491 9810 4785 3322 13527 18516 12439 1101 13830 15909 3876 10613 16...

result:

ok a perfect matching

Test #5:

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

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:

1195 9553 543 1060 6671 3949 9379 975 7766 5852 1667 4209 5027 1200 2871 1153 439 2045 8277 2164 9717 5190 1095 8512 7998 8533 576 8858 1459 7762 8213 8937 7963 7855 8464 3043 1280 4680 5788 4091 1001 2321 6077 2966 8065 7917 3201 525 9540 9456 3302 1943 9695 1768 828 4480 7100 2412 6298 8432 1049 1...

result:

ok a perfect matching

Test #6:

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

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:

1774 3791 1318 1776 1777 855 3520 3679 201 2449 2154 3508 732 913 3060 2101 3477 1822 2378 2224 3610 2646 3875 3760 236 3707 1859 1112 2290 2725 1550 3745 2603 2382 1938 372 3258 1546 106 297 1443 3840 839 3412 2943 1268 1254 3672 2120 1699 3301 1944 1625 1484 1000 2759 2117 3964 454 46 2989 3847 35...

result:

ok a perfect matching

Test #7:

score: 3.0303
Accepted
time: 16ms
memory: 102740kb

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:

1230 388 273 1744 423 1186 508 969 1149 775 961 776 1750 237 1509 1026 1678 379 245 285 1870 1352 1564 625 1231 516 993 1173 493 1774 380 97 1168 836 1300 26 1982 1299 768 1298 646 459 912 1886 920 1512 909 397 216 1844 398 512 1399 1169 1529 1665 1195 581 1792 767 645 1436 511 1717 290 703 411 1910...

result:

ok a perfect matching

Test #8:

score: 3.0303
Accepted
time: 18ms
memory: 102340kb

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:

269 187 473 59 300 313 88 45 740 38 754 814 617 286 491 34 375 865 52 711 423 77 105 560 287 102 857 302 523 677 905 501 341 619 520 402 788 502 937 86 10 602 165 943 896 504 686 625 784 883 393 894 723 125 281 824 765 977 632 760 101 60 916 185 71 268 574 503 669 877 233 651 330 456 5 741 420 388 9...

result:

ok a perfect matching

Test #9:

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

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:

58 246 87 145 279 254 7 334 54 608 568 404 94 343 629 44 433 535 89 392 623 126 574 233 449 10 195 274 435 238 665 197 236 455 253 26 360 407 589 465 23 314 586 325 448 480 337 248 341 536 519 100 508 474 282 335 430 545 62 8 259 339 416 485 297 417 402 609 348 564 260 575 540 393 505 410 475 66 182...

result:

ok a perfect matching

Test #10:

score: 3.0303
Accepted
time: 16ms
memory: 102972kb

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:

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

result:

ok a perfect matching

Test #11:

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

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: 15ms
memory: 102128kb

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: 1044ms
memory: 253760kb

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: 1854ms
memory: 180044kb

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 21413 740983 781326 137929 210831 427758 254720 871564 836016 31686 566788 321499 726558 616699 54080 117957 695703 767528 977706 94468 840677 451100 91765 642217 660136 373256 294316 522841 42217 556529 938408 232092 83664 133826 66848 793115 243028 474009 63141 276683 15...

result:

ok a perfect matching

Test #15:

score: 3.0303
Accepted
time: 1032ms
memory: 138700kb

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:

38271 61228 263792 132032 305018 165556 114442 26445 384092 260438 416988 282497 160039 293747 300340 207659 481256 383179 110698 170604 397873 473670 54300 111582 418363 321670 392626 209468 132676 229004 277732 29385 315593 325869 98672 297938 481433 73284 202093 478101 141981 385474 117192 79075 ...

result:

ok a perfect matching

Test #16:

score: 3.0303
Accepted
time: 672ms
memory: 128232kb

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 211046 61602 239399 85312 104228 109838 120649 142572 150731 111682 13010 224245 51878 140624 15069 177833 215451 29998 148407 218244 71443 151593 161898 8468 184335 36013 54228 109626 4642 46295 162713 90271 104781 110697 164215 76129 96623 88967 235984 110338 226659 20212 165055 45787 22056...

result:

ok a perfect matching

Test #17:

score: 3.0303
Accepted
time: 346ms
memory: 123936kb

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:

4752 29772 118521 50497 77960 95564 59907 66752 40242 21240 87144 95747 73957 124231 12327 66498 50597 31518 16808 50610 31114 97248 58065 27577 87001 82396 83444 66039 53754 92716 102480 41531 84547 6797 79595 4435 78121 102277 46547 369 71076 65049 76091 119156 22023 80126 75887 9149 104152 38249 ...

result:

ok a perfect matching

Test #18:

score: 3.0303
Accepted
time: 253ms
memory: 120872kb

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:

9493 31524 52217 36423 52674 17721 8707 54499 954 51444 154 11247 59186 36543 1699 25299 49325 51663 34994 8504 17494 24562 44025 20282 23405 12763 37277 17790 22121 5747 33892 55428 19744 62476 16277 43518 60810 36094 5629 47418 11944 42461 17402 45265 42740 44355 39040 30650 54300 45254 49708 1395...

result:

ok a perfect matching

Test #19:

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

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:

1284 7404 4153 14361 8441 11978 8616 11233 6586 9126 8008 12177 9649 10772 3517 7486 512 6661 6568 8786 14799 1508 6315 1691 5105 12950 8077 12637 9267 7881 5076 8998 10377 14505 950 13191 5276 1977 1121 3924 14064 2368 7244 1232 14458 5826 15311 5542 9459 11995 4312 5464 14096 14633 5036 813 13861 ...

result:

ok a perfect matching

Test #20:

score: 3.0303
Accepted
time: 83ms
memory: 117544kb

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:

62 582 1492 341 663 924 358 1066 1148 1031 1922 251 869 101 1317 1636 327 1797 1890 452 823 1 284 342 1667 1889 1515 1053 1136 1630 1947 1702 1896 1850 1437 588 1010 1046 578 1656 381 971 307 1350 623 1137 1151 1514 535 1175 268 1570 1489 468 1117 13 1534 338 1322 1603 576 740 1172 544 1261 1090 102...

result:

ok a perfect matching

Test #21:

score: 3.0303
Accepted
time: 73ms
memory: 117452kb

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:

125 220 121 11 97 52 126 141 60 74 225 113 34 164 65 212 128 135 178 122 134 200 123 233 5 88 64 78 175 170 94 57 179 151 96 47 54 14 231 33 120 188 153 22 63 237 144 219 158 81 101 218 174 198 222 7 49 169 156 83 62 211 147 17 72 199 243 40 130 196 27 194 192 191 127 229 190 48 8 46 41 117 129 201 ...

result:

ok a perfect matching

Test #22:

score: 3.0303
Accepted
time: 70ms
memory: 116932kb

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:

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

result:

ok a perfect matching

Test #23:

score: 3.0303
Accepted
time: 55ms
memory: 113156kb

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:

3 1 2 

result:

ok a perfect matching

Test #24:

score: 3.0303
Accepted
time: 1427ms
memory: 153180kb

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:

199437 414004 525296 278228 648864 203529 227388 414478 200513 81231 408644 149392 589635 345229 262678 390433 444322 85393 7842 204151 90374 257693 122992 647784 265475 224107 578299 406143 351294 521357 99555 90267 160239 228118 11376 262668 165004 88306 244173 544112 578702 501288 449580 158159 4...

result:

ok a perfect matching

Test #25:

score: 3.0303
Accepted
time: 495ms
memory: 137496kb

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:

185015 129764 97887 88598 33060 78767 110643 30422 140343 119807 168666 94741 59614 31921 64495 74364 164135 98165 135952 165805 128340 30490 893 24627 2402 46812 28909 162706 181355 117420 46341 12580 39133 46562 9173 45675 159027 74812 86100 76849 142310 63385 189945 47611 91467 137710 101063 1673...

result:

ok a perfect matching

Test #26:

score: 3.0303
Accepted
time: 334ms
memory: 131848kb

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:

69345 78615 62435 68184 20422 75875 20717 44246 36456 83714 27516 24175 19086 94143 21605 2822 7465 65508 27340 30144 50206 89161 13369 5589 37377 41520 48611 40486 38146 95122 37026 33301 57833 7257 75255 13657 82049 36600 98319 42930 95364 77536 32840 24031 6684 62996 98571 61472 34428 66271 77384...

result:

ok a perfect matching

Test #27:

score: 3.0303
Accepted
time: 210ms
memory: 124144kb

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:

39485 38648 26958 26863 865 38684 35343 5324 22117 20348 16790 25852 19128 37815 19417 21404 23363 14997 23703 17154 15763 21327 22038 4215 39642 5559 13484 26327 9342 7834 1527 8049 39347 33738 38939 14755 19172 31356 27811 32651 37757 31434 17833 5121 36996 1963 30703 35191 36721 24352 24589 37783...

result:

ok a perfect matching

Test #28:

score: 3.0303
Accepted
time: 166ms
memory: 123120kb

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:

16756 12182 18390 8372 3507 13975 6597 7771 16359 5780 18498 6887 17444 13997 16565 4986 16241 12787 12428 14475 4775 2443 8545 14747 7202 14627 14504 12610 13780 10702 14365 19219 13198 16908 17592 11121 15242 7979 7760 12427 9676 7134 11201 10945 15621 4376 10905 7631 5392 11736 231 8143 9639 1460...

result:

ok a perfect matching

Test #29:

score: 3.0303
Accepted
time: 113ms
memory: 129956kb

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:

5141 6185 5234 2187 1358 1814 6531 4820 3966 8 4198 3986 2399 555 1734 4639 3096 5318 4877 1176 2283 3842 3488 5244 4975 6624 2975 3941 4817 3173 2298 1343 645 272 4920 311 1965 3368 6008 562 6537 6361 2371 5937 117 1438 5834 4928 1697 5198 2834 833 59 125 3876 2942 1865 6037 2453 5186 5622 5152 360...

result:

ok a perfect matching

Test #30:

score: 3.0303
Accepted
time: 92ms
memory: 116484kb

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:

250 1375 512 805 4 1460 834 1683 1201 1074 1860 664 1055 1336 1392 383 1258 1288 824 1993 233 1876 734 957 743 1763 929 982 1498 1253 1500 325 943 1211 785 366 1447 907 938 41 921 616 1965 3 1759 410 217 1671 620 1631 126 1027 963 1672 1779 778 691 527 989 357 750 759 916 1449 1997 189 1837 937 1772...

result:

ok a perfect matching

Test #31:

score: 3.0303
Accepted
time: 46ms
memory: 118728kb

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:

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

result:

ok a perfect matching

Test #32:

score: 3.0303
Accepted
time: 66ms
memory: 120368kb

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:

4 3 1 2 

result:

ok a perfect matching

Test #33:

score: 3.0303
Accepted
time: 64ms
memory: 115640kb

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