QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#464497#265. 正则二分图匹配CharlieVinnie100 ✓886ms42724kbC++17920b2024-07-06 10:17:542024-07-06 10:17:54

Judging History

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

  • [2024-07-06 10:17:54]
  • 评测
  • 测评结果:100
  • 用时:886ms
  • 内存:42724kb
  • [2024-07-06 10:17:54]
  • 提交

answer

#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define Fin(file) freopen(file,"r",stdin)
#define Fout(file) freopen(file,"w",stdout)
#define LOG(...) fprintf(stderr,__VA_ARGS__)
using namespace std; using ll = long long;
constexpr int N=2e6+5;
int n,d,To[N],cp[N]; mt19937 rng(330312);
int& to(int i,int j) { return To[(i-1)*d+j]; }
int main(){
	cin>>n>>d; For(i,0,n*d-1) cin>>To[i];
	vector<int> qwq(n); For(i,1,n) qwq[i-1]=i;
	shuffle(qwq.begin(),qwq.end(),rng);
	for(int o:qwq){
		static int vis[N],lis[N]; int lcnt=0,u=o;
		while(u){
			int v; do v=to(u,rng()%d); while(cp[v]==u);
			while(vis[v]) vis[lis[lcnt--]]=0;
			vis[lis[++lcnt]=v]=1; u=cp[v];
		}
		For(i,1,lcnt) { int v=lis[i]; vis[v]=0; swap(o,cp[v]); }
		lcnt=0;
	}
	static int ans[N]; For(i,1,n) ans[cp[i]]=i;
	For(i,1,n) cout<<ans[i]<<' ';; cout<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 3.0303
Accepted
time: 44ms
memory: 15740kb

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: 56ms
memory: 10760kb

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: 54ms
memory: 12344kb

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 66049 55999 27855 7925 21726 52528 6408 15771 34506 42730 25251 65939 37494 18356 20154 17174 62088 5195 36214 59655 46145 17925 47027 31863 34209 52130 38212 25501 17388 11569 59567 59114 10322 44265 36467 17419 52012 18633 63022 12216 51908 28138 37820 28272 43328 28826 3746 38803 6160 12914 ...

result:

ok a perfect matching

Test #4:

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

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:

19810 14209 10028 1543 12314 10892 3726 14381 18325 16354 18171 11347 12430 16885 8191 18334 4041 12545 4695 5759 18910 19530 1652 14844 18643 15705 10736 10424 8913 499 15372 6452 19194 783 16698 10358 18405 19728 15189 16748 3311 14043 7342 1807 15259 2142 2230 13530 10104 16976 15567 11690 2347 4...

result:

ok a perfect matching

Test #5:

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

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:

9158 6687 1201 8528 595 208 6168 8048 3308 6774 6408 8275 8298 1444 8911 4085 5703 9539 4161 192 3583 1450 8609 4598 5200 7078 6006 7621 3691 3526 1468 2647 4849 7285 6514 6557 6177 7453 5788 4684 6533 7212 6500 5251 8065 5904 179 5497 9659 7745 2035 503 8193 331 8007 4024 5006 2412 9945 276 4123 89...

result:

ok a perfect matching

Test #6:

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

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:

738 2626 2371 1798 3896 574 3676 2933 887 1501 928 3684 3962 1913 2400 2005 2381 890 1256 1895 3480 3257 3664 1660 1368 2936 693 3032 2387 80 2763 388 3579 3602 1975 3709 2261 2931 1234 3524 417 3017 1490 1872 3 635 3929 3122 2671 593 1609 1077 644 2366 1413 1087 3762 576 2043 3843 3288 13 1407 2932...

result:

ok a perfect matching

Test #7:

score: 3.0303
Accepted
time: 28ms
memory: 11848kb

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:

1395 992 1077 1089 1963 1680 1016 852 1508 1005 506 647 37 1271 1420 198 576 1889 1272 1081 660 831 1923 625 133 1274 470 262 1864 1609 1580 1207 238 201 1488 809 567 1412 119 93 1890 1147 1467 1436 1119 1097 504 1545 1962 1493 1955 18 546 1658 1012 670 304 236 847 1022 1344 1692 1691 1884 497 1537 ...

result:

ok a perfect matching

Test #8:

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

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:

862 240 971 703 910 432 245 944 576 840 889 811 54 553 475 296 671 400 849 62 487 586 154 239 287 545 139 681 473 991 116 604 26 286 559 830 557 457 317 346 290 283 613 746 304 563 539 809 716 885 904 233 217 371 923 393 355 933 273 151 79 212 538 39 517 61 84 764 952 728 561 221 567 479 71 196 796 ...

result:

ok a perfect matching

Test #9:

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

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:

279 262 226 590 151 486 228 44 380 255 384 192 71 361 426 272 631 336 588 288 99 175 26 18 362 367 127 252 388 250 121 617 15 616 96 307 358 102 466 69 445 419 520 308 439 299 236 474 620 112 448 487 470 47 516 155 369 84 489 508 178 200 49 16 1 469 621 342 114 234 382 172 261 62 296 651 123 302 452...

result:

ok a perfect matching

Test #10:

score: 3.0303
Accepted
time: 15ms
memory: 9752kb

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:

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

result:

ok a perfect matching

Test #11:

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

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:

1 2 

result:

ok a perfect matching

Test #12:

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

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: 565ms
memory: 42724kb

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: 886ms
memory: 31200kb

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: 673ms
memory: 23308kb

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 61228 361339 132032 305018 253636 49634 179574 384092 356066 247869 290882 191935 37814 63649 275595 147666 323604 475326 170604 255210 5997 435471 111582 418363 263970 32429 36726 415559 480610 480020 141220 315593 195136 98672 115932 481433 73284 380847 462026 307776 29643 434103 79075 4202...

result:

ok a perfect matching

Test #16:

score: 3.0303
Accepted
time: 500ms
memory: 18340kb

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 99955 152333 156434 106345 104228 106979 135533 41703 150731 111682 236846 234928 51878 172172 15069 78369 130873 199939 211999 218244 238410 89146 30362 202244 222429 150247 95303 242568 51269 223048 162713 235329 141461 51933 225960 72715 153748 19573 235984 9083 103096 65271 97989 45787 16...

result:

ok a perfect matching

Test #17:

score: 3.0303
Accepted
time: 389ms
memory: 17092kb

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 79629 91749 123517 117697 85617 69402 81900 110814 8773 80722 34854 72126 96269 22072 115660 70422 24316 26816 115370 107151 19508 241 124635 18264 78121 84616 96912 102053 40678 67935 85160 1224 25296 81595 51443 74666 87634 52305 65644 77326 2472 88226 77170 25091 80126 74881 20739 9465 93075...

result:

ok a perfect matching

Test #18:

score: 3.0303
Accepted
time: 336ms
memory: 16412kb

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:

11044 60424 2936 56109 10647 56991 2437 38588 34125 2076 57217 29410 59186 26022 6234 36268 48986 52406 49560 17250 37494 60356 5941 14738 23157 50179 1568 15111 61069 39441 30662 55428 36719 35898 5641 7432 22113 59539 42352 31455 47768 36437 5566 42806 61452 375 40939 60329 35376 26968 4454 61333 ...

result:

ok a perfect matching

Test #19:

score: 3.0303
Accepted
time: 298ms
memory: 16332kb

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:

51 5470 9759 8482 4543 12715 665 10453 8189 9856 9369 7811 7989 6342 1311 7108 3271 2411 44 4710 113 5764 11928 6270 165 8819 6526 15361 6250 14502 11512 15356 9897 4078 12921 14321 13511 9681 11996 1347 217 15458 7763 2889 11724 4875 3162 11521 3132 14296 14163 2095 9984 9334 6021 8688 12074 1399 6...

result:

ok a perfect matching

Test #20:

score: 3.0303
Accepted
time: 256ms
memory: 16200kb

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:

216 1528 822 757 1566 1693 1344 1506 1798 659 403 299 787 1940 951 1479 1941 679 1745 66 690 891 1092 143 1374 1877 1401 1053 1696 816 372 145 384 278 1600 1101 1069 1206 1167 301 1313 1837 1359 781 973 1078 1282 857 1715 32 293 1390 613 874 785 1346 1944 545 958 823 1084 910 1680 1095 1899 1141 653...

result:

ok a perfect matching

Test #21:

score: 3.0303
Accepted
time: 228ms
memory: 15928kb

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:

131 217 48 13 176 82 139 39 34 133 83 225 232 178 228 208 150 119 149 173 129 168 59 69 88 193 10 64 53 174 143 99 38 157 97 165 52 156 62 197 202 117 184 120 94 135 91 219 177 81 151 26 44 209 121 40 50 226 118 76 111 236 32 187 36 182 37 154 181 49 222 230 148 128 54 27 95 192 30 166 137 215 17 19...

result:

ok a perfect matching

Test #22:

score: 3.0303
Accepted
time: 188ms
memory: 15952kb

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:

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

result:

ok a perfect matching

Test #23:

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

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: 759ms
memory: 25240kb

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 525296 267125 266873 516958 647002 414478 287454 139438 408644 74579 466358 186366 455975 281668 444322 232679 7842 135998 63789 647630 425578 202099 136399 224107 362598 31353 351294 521357 260268 90267 145895 57759 11376 345135 12470 88306 616163 544112 578702 501288 95016 482586 46888...

result:

ok a perfect matching

Test #25:

score: 3.0303
Accepted
time: 456ms
memory: 19876kb

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:

2798 186477 2825 116509 99908 153810 118168 28454 158350 74964 96771 33943 138538 24619 192109 183745 162088 107387 80334 57943 98742 5514 22123 120077 105333 125592 28909 49366 181355 131646 157327 182018 46177 46562 151026 16563 57289 175867 86100 69955 146684 63385 37037 61804 89047 120262 141190...

result:

ok a perfect matching

Test #26:

score: 3.0303
Accepted
time: 365ms
memory: 16716kb

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:

40598 24889 37640 80666 23457 17858 79758 68635 74833 91148 27516 2947 61498 70099 2676 19824 47912 59951 34806 81840 63592 89361 78787 8529 62218 85133 21511 98225 64619 81596 96896 61499 78150 31641 58851 74427 2306 7868 93474 68868 83196 29113 99713 13075 27999 50280 15469 61969 28407 81773 280 2...

result:

ok a perfect matching

Test #27:

score: 3.0303
Accepted
time: 336ms
memory: 16228kb

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:

31099 12134 3150 38383 19460 28040 31755 16187 36699 11373 38517 5238 1620 11199 5090 1422 31844 37567 11871 12860 15763 13209 4465 22877 21911 38852 1167 38499 7636 17086 34954 12213 39897 27546 12856 18927 15082 31762 32253 14801 34841 24155 8698 24302 29319 28892 6376 25792 31685 20938 15929 6648...

result:

ok a perfect matching

Test #28:

score: 3.0303
Accepted
time: 306ms
memory: 16092kb

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:

12697 14932 15878 18480 15415 9961 2444 3804 2361 15635 15071 15754 11569 17736 5561 6123 12784 4678 2629 8410 13228 10582 9213 16509 861 12563 3450 879 12017 883 5492 600 13092 100 9810 833 11666 3497 8075 11785 18709 19319 9282 13944 3821 8875 17888 18188 6082 14713 6514 2637 17106 1576 3587 10007...

result:

ok a perfect matching

Test #29:

score: 3.0303
Accepted
time: 296ms
memory: 16192kb

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:

1632 4616 1389 4983 6661 4288 4116 4820 5175 2470 1444 4213 2813 1242 2727 2274 1991 1394 4105 4092 903 4677 4517 6632 3114 6655 4290 3875 3251 2254 2121 1695 6557 258 1648 6477 2664 305 3689 1046 5104 5748 644 3066 2640 6054 3010 5711 4366 2800 3790 749 4839 2915 4585 6618 2636 6553 4730 2676 5592 ...

result:

ok a perfect matching

Test #30:

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

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:

1778 1253 678 465 1632 1169 1918 762 1045 614 835 530 1729 1580 265 13 117 858 101 801 120 1898 768 1845 516 383 245 959 1203 598 601 1714 965 1606 879 798 1371 707 541 649 128 1225 439 1709 1454 1534 1250 1475 522 264 716 1958 1823 1007 1485 403 1605 394 668 300 1882 6 241 148 1681 1265 1981 66 155...

result:

ok a perfect matching

Test #31:

score: 3.0303
Accepted
time: 202ms
memory: 15864kb

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

result:

ok a perfect matching

Test #32:

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

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

result:

ok a perfect matching

Test #33:

score: 3.0303
Accepted
time: 162ms
memory: 13876kb

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