QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#128986#265. 正则二分图匹配lltzahd#100 ✓1563ms136252kbC++201.1kb2023-07-21 17:42:272023-07-21 17:42:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-21 17:42:28]
  • 评测
  • 测评结果:100
  • 用时:1563ms
  • 内存:136252kb
  • [2023-07-21 17:42:27]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
constexpr int N = 2e6 + 10;
int n, d, match[N], bak[N];
vector<int> G[N];
int main() {
	// freopen("in.txt", "r", stdin);
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> d;
	for(int i = 0; i < n; i ++) {
		for(int j = 0, x; j < d; j ++) {
			cin >> x;
			G[i + 1].emplace_back(x);
		}
	}
	mt19937 hua(20000724);
	for(int i = 1; i <= n; i ++) {
		static int stk[N], top;
		static int vis[N];
		int x = i;
		while(1) {
			int y = G[x][hua() % G[x].size()];
			while(y == match[x]) y = G[x][hua() % G[x].size()];
			stk[++ top] = x;
			vis[x] = 1;
			if(!bak[y]) {
				for(int i = 1; i < top; i ++) {
					match[stk[i]] = match[stk[i + 1]];
					bak[match[stk[i + 1]]] = stk[i];
				}
				match[x] = y, bak[y] = x;
				for(int i = 1; i <= top; i ++) {
					vis[stk[i]] = 0;
				}
				top = 0;
				break;
			}
			x = bak[y];
			while(vis[x]) {
				vis[stk[top]] = 0;
				top--;
			}
		}
	}
	for(int i = 1; i <= n; i ++) {
		cout << match[i] << " \n"[i == n];
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 71ms
memory: 56716kb

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 82625 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 77366 14212 92309 60161 97360 84131 2831 25716 38120 20898 1...

result:

ok a perfect matching

Test #3:

score: 3.0303
Accepted
time: 52ms
memory: 55200kb

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 55999 27855 7925 35131 63257 27039 15771 34506 11376 6007 28813 10460 18356 50645 17174 52076 32779 21328 57776 46145 40571 24590 31863 46800 52130 64048 60419 27892 14263 52945 37938 10322 52273 36467 17419 52012 18633 35913 10873 10239 28138 25549 16498 6746 3448 24434 43681 61505 1291...

result:

ok a perfect matching

Test #4:

score: 3.0303
Accepted
time: 27ms
memory: 54088kb

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 7145 1987 10106 3906 1957 15280 10656 9955 11071 10046 17944 13980 2879 5725 18334 5496 8157 10759 8603 18910 2848 5850 4390 13282 15249 10736 11399 17531 18715 4625 12216 9304 6990 1928 8785 18405 18899 18680 10909 3311 13940 2423 18658 9810 9803 4655 2167 11014 16976 11265 11690 15909 7133 1...

result:

ok a perfect matching

Test #5:

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

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:

2218 816 7148 6700 5331 7581 9379 9434 9704 6774 1667 6249 5027 643 8649 3195 6944 6507 8485 2164 5954 4359 4656 7832 2171 1035 4726 3217 3053 7246 3295 8937 6344 5377 9747 7512 540 6376 8582 4684 256 4145 3945 3586 1269 9725 2305 1253 6279 5581 9060 30 595 893 5909 9523 7100 2302 7642 914 5762 6047...

result:

ok a perfect matching

Test #6:

score: 3.0303
Accepted
time: 14ms
memory: 53848kb

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:

676 1082 2732 2576 1912 3180 1746 2544 3698 3468 3787 2163 2697 820 1615 1383 111 3720 929 1972 2594 373 278 3744 2937 1866 620 3943 2720 3346 3167 3004 236 2465 52 2142 2555 1890 3295 1605 3729 1160 2268 2090 327 1085 2329 2637 3335 126 3067 1379 3144 3885 2863 2024 3199 3667 1761 2897 2055 2650 19...

result:

ok a perfect matching

Test #7:

score: 3.0303
Accepted
time: 12ms
memory: 55248kb

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:

330 1540 1638 1751 208 933 1166 1592 881 896 608 1004 1102 1886 1836 1700 211 190 746 1269 1629 255 566 1372 800 1647 1654 402 851 1774 198 590 224 139 1813 1844 1606 1080 544 901 1892 1979 1815 1696 1798 1992 455 705 1807 635 1048 1268 73 446 416 1342 1834 164 4 599 1479 1442 1212 1823 1222 424 105...

result:

ok a perfect matching

Test #8:

score: 3.0303
Accepted
time: 7ms
memory: 55400kb

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:

106 825 578 440 63 280 296 193 192 241 442 769 747 308 611 270 749 173 711 159 288 910 268 974 130 671 900 204 775 744 459 834 436 433 931 830 804 121 146 249 321 865 642 600 85 630 807 256 203 285 382 979 601 131 985 728 83 358 336 15 339 944 111 567 655 827 381 461 908 250 478 305 981 211 180 197 ...

result:

ok a perfect matching

Test #9:

score: 3.0303
Accepted
time: 23ms
memory: 53868kb

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:

383 94 434 541 245 242 132 332 149 88 13 323 313 555 407 162 303 490 23 618 482 355 399 87 532 587 414 226 95 50 53 550 491 30 613 385 55 637 354 256 318 542 319 58 21 551 188 506 287 270 450 473 358 33 626 616 113 657 83 67 639 648 222 236 174 585 185 642 397 622 559 464 396 62 545 191 239 517 543 ...

result:

ok a perfect matching

Test #10:

score: 3.0303
Accepted
time: 8ms
memory: 54832kb

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 2 10 7 6 17 9 14 1 11 16 4 5 19 18 12 13 20 3 15

result:

ok a perfect matching

Test #11:

score: 3.0303
Accepted
time: 14ms
memory: 54608kb

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: 8ms
memory: 53928kb

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: 317ms
memory: 136252kb

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: 1563ms
memory: 96748kb

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 321499 726558 616699 54080 586699 695703 767528 977706 94468 840677 451100 91765 798274 660136 280560 138177 155987 749454 322629 938408 232092 83664 796647 66848 300748 137995 474009 63141 276683...

result:

ok a perfect matching

Test #15:

score: 3.0303
Accepted
time: 1303ms
memory: 74016kb

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 469434 441492 276847 141419 468748 114442 46027 182112 260438 423517 290882 191935 184280 63649 368334 65848 492497 475326 170604 321771 404653 435471 111582 364565 408524 32429 392417 132676 480610 480020 362915 203584 195136 98672 110967 484531 24973 202093 58641 283356 385474 117192 79075 ...

result:

ok a perfect matching

Test #16:

score: 3.0303
Accepted
time: 394ms
memory: 66052kb

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:

146917 99955 69725 126306 39270 90740 109838 135533 172972 18921 21290 3958 227410 51878 249209 128428 207051 70703 29998 211999 167194 26197 89146 94040 95244 184335 111490 69801 84530 205400 46295 162713 115998 30205 110697 205812 933 39100 88967 161167 56248 103096 1051 150524 222265 39653 73500 ...

result:

ok a perfect matching

Test #17:

score: 3.0303
Accepted
time: 270ms
memory: 66492kb

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:

107139 5273 89583 110528 71396 111209 76194 25599 38827 105537 69697 101796 111524 96657 22072 66498 20258 85862 70675 106632 5356 76128 23132 27577 35992 41866 12120 104813 94154 92563 48449 11813 108716 86070 18622 76439 43851 95820 52305 16426 51480 73306 88226 117407 239 65662 101668 40662 9091 ...

result:

ok a perfect matching

Test #18:

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

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:

9882 12466 401 9475 46256 61736 53268 34600 34956 23212 40343 49243 4160 53610 6249 11590 25515 36449 34958 12883 46327 46880 46885 56444 23405 50707 6770 35614 53636 48566 33518 17623 1874 44611 24965 51379 11562 41028 38615 40245 7643 23251 12474 52653 42740 21439 61223 59710 29242 30818 5730 1962...

result:

ok a perfect matching

Test #19:

score: 3.0303
Accepted
time: 106ms
memory: 61280kb

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:

6410 12434 112 5068 11098 11276 8321 410 10314 1323 955 1588 4853 13322 2028 6171 5755 14285 15242 7639 9931 10744 5357 13372 8701 10550 890 4196 5634 11884 9814 8366 1220 5673 9650 6089 9247 14656 13231 3518 5709 12595 13455 11725 13936 4779 7675 9426 1125 10567 5095 993 12010 13296 3769 7349 2025 ...

result:

ok a perfect matching

Test #20:

score: 3.0303
Accepted
time: 78ms
memory: 60772kb

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:

1237 1751 1415 1274 810 1076 896 1403 1543 1759 1700 1182 181 1039 1086 1781 362 1792 1603 508 1127 444 1526 1055 1435 155 287 187 1767 410 1597 269 185 669 1297 489 1594 1816 1641 520 131 953 1071 1768 430 1501 904 1465 959 521 160 454 374 683 1634 650 1223 1233 74 1123 227 817 1916 93 1944 1705 13...

result:

ok a perfect matching

Test #21:

score: 3.0303
Accepted
time: 79ms
memory: 60280kb

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:

148 25 173 80 177 103 223 83 197 55 167 95 71 202 226 149 161 151 32 50 244 210 16 158 194 63 165 213 29 127 229 147 159 81 61 66 117 109 91 145 97 198 135 56 164 154 124 232 76 200 240 239 169 40 30 115 175 96 163 19 90 144 73 195 162 221 113 5 234 206 111 230 207 64 6 190 75 72 4 160 134 146 241 1...

result:

ok a perfect matching

Test #22:

score: 3.0303
Accepted
time: 59ms
memory: 60012kb

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 1 3 6 12 30 29 2 21 9 25 19 22 28 7 24 15 10 8 23 18 14 16 27 5 13 20 4 17 11

result:

ok a perfect matching

Test #23:

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

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

result:

ok a perfect matching

Test #24:

score: 3.0303
Accepted
time: 1545ms
memory: 80516kb

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 414004 133162 267125 266873 203529 227388 512085 287454 488811 487195 515012 589635 186366 255056 281668 444322 227367 491616 135998 90374 257693 453716 647784 346689 224107 362598 31353 106383 521357 260268 360589 160239 227431 11376 345135 12470 88306 244173 293900 181409 405030 482006 158159...

result:

ok a perfect matching

Test #25:

score: 3.0303
Accepted
time: 408ms
memory: 72772kb

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:

122650 167767 107376 43877 76078 153810 118168 113848 195780 74964 64957 170413 54544 91346 93332 117073 175962 98165 130533 73903 16189 30490 29196 128991 105333 46812 67144 68002 125895 92130 94377 12580 39133 154845 16981 165958 17025 120048 11884 42952 166277 110181 114749 73531 157429 28636 969...

result:

ok a perfect matching

Test #26:

score: 3.0303
Accepted
time: 224ms
memory: 67504kb

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:

84895 14803 43893 13891 59387 66440 18606 93706 60891 64485 64972 17131 16495 40779 26204 1770 68212 65508 42437 88667 10704 61076 53022 96294 99083 23355 21511 40542 88645 31784 12246 33301 95442 83606 18325 69080 58755 55514 88004 1847 12016 76136 65810 71857 6684 30749 27483 45502 93626 34216 920...

result:

ok a perfect matching

Test #27:

score: 3.0303
Accepted
time: 133ms
memory: 64232kb

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:

19069 33427 5907 33425 33455 29890 9539 6168 17219 7804 4635 4333 16527 30078 16363 8984 32805 11640 32081 36537 4409 22689 5508 29268 39642 35682 37064 30874 22146 13199 937 38759 2836 11882 22222 15579 25625 31356 38646 14625 23442 6207 16437 27888 12684 27092 15217 15507 13772 31493 33691 22917 3...

result:

ok a perfect matching

Test #28:

score: 3.0303
Accepted
time: 97ms
memory: 62880kb

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:

781 10436 5291 9483 18554 13781 8931 17178 3896 18469 18472 2172 5504 2590 8454 15306 4424 9433 4590 1114 15032 8106 3561 13713 6902 7312 2328 3504 3954 12990 1285 7745 10205 19600 14573 4827 10447 2159 5249 18258 14044 12120 3727 19041 15106 814 13025 17630 5488 18808 13406 291 10934 4905 1266 1616...

result:

ok a perfect matching

Test #29:

score: 3.0303
Accepted
time: 105ms
memory: 67736kb

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:

5546 1890 997 3470 2673 3943 6244 4027 5249 1597 3070 1995 4640 58 453 4456 3352 5717 3525 342 3116 1215 4528 5226 4880 2254 788 4859 3263 5817 1117 1185 2435 524 2931 799 368 467 5430 734 2688 2174 1842 3003 4961 280 3097 3350 5023 6134 4102 5776 1092 3752 169 2366 955 4562 1135 2153 2767 772 6635 ...

result:

ok a perfect matching

Test #30:

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

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:

1500 820 135 1253 1965 202 1995 344 500 604 323 736 358 210 1397 1544 552 1195 867 1329 882 1757 1974 213 472 1066 145 1179 1930 1040 1082 306 1360 1163 1867 1620 756 1290 1026 1750 1140 599 1029 1042 346 231 1386 758 666 917 496 1695 131 1515 837 1890 22 1393 1473 897 1999 292 800 1264 173 980 1488...

result:

ok a perfect matching

Test #31:

score: 3.0303
Accepted
time: 40ms
memory: 60680kb

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:

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

result:

ok a perfect matching

Test #32:

score: 3.0303
Accepted
time: 51ms
memory: 62164kb

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 4 3

result:

ok a perfect matching

Test #33:

score: 3.0303
Accepted
time: 54ms
memory: 63684kb

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