QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#458701#265. 正则二分图匹配251Sec100 ✓1403ms140576kbC++14989b2024-06-29 18:34:032024-06-29 18:34:03

Judging History

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

  • [2024-06-29 18:34:03]
  • 评测
  • 测评结果:100
  • 用时:1403ms
  • 内存:140576kb
  • [2024-06-29 18:34:03]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937 eng(363415);
int rnd(int l, int r) { return eng() % (r - l + 1) + l; }
int n, d;
vector<int> e[2000005];
int mat[4000005], id[2000005];
int st[6000005], top;
bool vis[4000005];
int main() {
	scanf("%d%d", &n, &d);
	for (int i = 1; i <= n; i++) {
		e[i].resize(d);
		for (int j = 0; j < d; j++) scanf("%d", &e[i][j]);
		id[i] = i;
	}
	shuffle(id + 1, id + n + 1, eng);
	for (int i = 1; i <= n; i++) {
		int u = id[i];
		st[++top] = u; vis[u] = true;
		while (u) {
			int v;
			do v = e[u][rnd(0, e[u].size() - 1)] + n; while (v == mat[u]);
			while (vis[v]) vis[st[top--]] = false;
			vis[st[++top] = v] = true;
			st[++top] = (u = mat[v]);
		}
		top--;
		for (int i = top; i; i -= 2) {
			int a = st[i], b = st[i - 1];
			mat[a] = b, mat[b] = a;
		}
		while (top) vis[st[top--]] = false;
	}
	for (int i = 1; i <= n; i++) printf("%d%c", mat[i] - n, " \n"[i == n]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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: 63ms
memory: 55500kb

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 3259 65310 3379 35446 52528 27039 37822 34506 11376 46717 4858 38602 26954 56311 17174 52076 5195 12848 57776 50927 23515 47027 62091 27065 47712 64048 37895 59559 11569 59567 37938 10322 52273 32676 17419 66265 63154 63022 12216 10239 40790 25549 16498 6746 28826 3746 43681 6160 33786 493...

result:

ok a perfect matching

Test #4:

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

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 8862 3395 10944 4908 16496 4264 10656 18637 9944 18171 12192 14497 12845 3592 19277 8971 8157 8934 7622 18910 2563 2399 17068 373 15705 9215 7596 14850 16018 5735 7201 4500 7079 1928 1818 19738 1857 17207 10554 17334 11859 19566 1807 13312 18200 11270 3147 18516 2126 3869 17468 2347 2385 11671...

result:

ok a perfect matching

Test #5:

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

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 8549 1201 1933 5523 1644 3750 116 5174 8757 5472 1500 9337 703 1877 3143 5901 3364 3471 2147 3864 5190 4900 4598 4998 7078 6006 1064 1459 3159 3125 7106 9353 9761 7215 4151 954 279 5773 7508 6533 7178 4548 4509 7381 7717 8179 2793 3494 89 2035 7800 7997 331 5516 6824 3292 3030 7388 3037 6194 66...

result:

ok a perfect matching

Test #6:

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

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:

2976 2806 3838 3207 2810 3193 3506 943 3727 2916 3045 66 2697 1211 2170 1629 3562 138 2232 3739 2594 830 396 111 2747 3507 3502 3316 410 2531 1755 1576 3374 264 909 2018 966 3263 1711 1605 332 2372 3510 2242 2881 2318 1804 1468 1428 1842 3003 2193 1400 17 2873 3887 1067 520 576 799 1772 3384 2048 90...

result:

ok a perfect matching

Test #7:

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

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:

571 1188 42 709 1680 609 1276 1004 1922 1635 7 1257 293 1778 1748 252 755 463 664 1457 228 1886 1056 1217 1785 457 1878 1011 505 410 945 1929 101 1447 1406 1435 1028 349 202 361 1638 1625 1095 460 837 279 246 183 850 906 672 839 1307 439 747 1574 249 1730 375 458 497 412 269 181 932 156 1063 484 179...

result:

ok a perfect matching

Test #8:

score: 3.0303
Accepted
time: 11ms
memory: 52396kb

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:

683 512 721 612 11 811 932 666 79 282 742 598 720 543 558 881 824 293 469 431 845 923 328 195 204 186 217 620 677 949 426 363 837 222 493 844 969 953 454 67 416 129 951 118 385 759 387 744 646 291 446 406 532 323 465 896 136 356 638 463 723 103 481 85 150 863 797 228 833 82 497 355 473 213 5 965 124...

result:

ok a perfect matching

Test #9:

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

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:

117 401 540 25 547 621 596 342 640 597 29 541 533 388 487 262 557 437 427 367 277 423 472 576 577 634 322 589 604 174 305 209 251 450 480 45 138 170 286 484 344 116 358 168 32 226 517 355 42 248 18 632 474 429 446 432 207 430 416 165 173 146 461 460 426 521 579 303 575 7 665 238 440 428 595 179 539 ...

result:

ok a perfect matching

Test #10:

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

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:

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

result:

ok a perfect matching

Test #11:

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

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: 11ms
memory: 52704kb

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: 482ms
memory: 140576kb

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: 1403ms
memory: 101780kb

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 266427 905137 189618 616699 54080 117957 695703 178663 977706 850365 840677 451100 227766 642217 660136 373256 294316 522841 42217 556529 736226 460261 398160 133826 956633 793115 243028 726017 248166 5841...

result:

ok a perfect matching

Test #15:

score: 3.0303
Accepted
time: 682ms
memory: 76224kb

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 441492 55336 305018 256179 49634 26445 450681 392443 247869 290882 378657 184280 140596 368334 113288 132522 27368 186917 230363 5997 54300 161626 364565 263970 392626 392417 200017 92277 277732 141220 142095 475283 466169 297938 4677 349403 100240 462026 141981 220992 447977 79075 42026...

result:

ok a perfect matching

Test #16:

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

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 197939 191567 126306 123219 4520 106979 192219 142572 158058 173646 150215 170786 43549 140624 54852 163519 70703 234253 1433 7380 40853 209750 161898 116428 162392 150247 54228 190349 163323 46295 244582 151800 104781 191397 99812 26143 39100 63033 161167 100200 200378 54046 116155 1275 1006...

result:

ok a perfect matching

Test #17:

score: 3.0303
Accepted
time: 225ms
memory: 63932kb

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:

35622 91989 33836 69229 25135 2221 76194 97218 119154 55349 71874 56732 108358 110621 22072 76365 53519 48107 6449 49240 81025 114572 23132 93169 57481 119389 25532 12445 27030 92716 102480 99954 107822 25296 86229 34803 88902 82731 81408 83045 47041 60417 124023 31491 22023 25998 58184 11018 87480 ...

result:

ok a perfect matching

Test #18:

score: 3.0303
Accepted
time: 153ms
memory: 63668kb

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:

44352 59899 28648 44169 43092 29443 2437 41829 53532 21171 28315 28992 61528 26733 1753 25299 22956 13125 30283 1131 42350 34294 57669 901 60273 46306 9968 28943 20818 31702 45087 34367 35685 13089 3890 21832 26944 58233 59582 27476 20115 9430 7354 29038 36970 19960 53988 29888 46219 20711 4494 6133...

result:

ok a perfect matching

Test #19:

score: 3.0303
Accepted
time: 116ms
memory: 62932kb

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:

7474 6170 3496 4917 13149 13437 13931 5381 8644 299 8969 13873 15522 52 11211 7112 7419 14307 10937 657 1181 8414 4807 54 461 8028 12985 4373 3281 11884 5270 3047 12559 15218 13556 3943 75 12800 10166 3601 12813 5571 9814 10169 11664 356 12200 2946 11339 4198 7585 13934 3626 12692 11324 13341 10908 ...

result:

ok a perfect matching

Test #20:

score: 3.0303
Accepted
time: 95ms
memory: 61740kb

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:

661 484 766 779 1121 933 1131 110 1107 741 752 1623 1879 853 128 859 202 988 139 825 743 84 782 309 685 541 662 336 639 340 1458 1898 286 1308 608 949 355 1645 877 1402 630 1405 1049 26 118 140 851 312 1726 29 384 910 1791 959 563 1604 1283 1180 499 675 160 142 1008 321 1755 1723 838 158 1661 1387 1...

result:

ok a perfect matching

Test #21:

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

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:

211 83 76 241 2 187 104 26 161 79 233 39 237 103 64 35 228 225 73 113 71 119 17 179 20 220 51 94 236 61 126 93 98 235 114 109 5 63 99 86 9 123 148 108 90 193 199 189 75 201 135 229 217 124 172 21 7 85 57 232 207 177 122 65 147 215 181 224 133 80 230 15 33 160 196 121 138 223 213 68 206 194 182 45 20...

result:

ok a perfect matching

Test #22:

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

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:

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

result:

ok a perfect matching

Test #23:

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

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

result:

ok a perfect matching

Test #24:

score: 3.0303
Accepted
time: 1035ms
memory: 81064kb

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 525296 267125 266873 203529 647002 414478 287454 139438 180775 74579 620337 345229 255056 281668 91393 232679 7842 135998 63789 647630 425578 202099 265475 56468 239426 271801 351294 201039 99555 90267 145895 228118 11376 345135 466198 88306 616163 544112 146184 501288 482006 482586 468...

result:

ok a perfect matching

Test #25:

score: 3.0303
Accepted
time: 326ms
memory: 66508kb

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 51804 19363 78934 90490 118168 113848 166878 119807 178507 54575 61775 196124 53329 114005 175962 1957 171148 192067 98742 51831 87350 119633 183772 158193 146847 1658 8511 31335 94377 129281 46177 102702 65307 9455 57289 175867 75886 128245 21131 146203 94478 61804 89047 63360 158251 61...

result:

ok a perfect matching

Test #26:

score: 3.0303
Accepted
time: 198ms
memory: 64940kb

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:

67349 79627 43005 67849 20422 10356 18606 68635 36456 62795 19260 18040 19086 94143 60468 46816 7465 10275 27749 88667 99369 54677 82695 43202 62218 68554 29225 1285 38237 13826 50296 22034 24934 74005 24645 13657 58755 30571 61219 29715 47538 35387 99713 76535 36436 63598 98571 61472 3095 35163 320...

result:

ok a perfect matching

Test #27:

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

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:

20658 12134 22109 36193 20573 28040 31755 30040 14807 8051 38517 26054 12671 29925 21701 20840 28662 6010 32081 26970 12213 7748 33307 15091 4675 37024 19475 36887 25774 7088 34954 18417 35242 9818 2758 15579 24807 3633 23367 18154 38842 7262 2146 38969 18001 13186 38506 4930 31084 23224 27003 9173 ...

result:

ok a perfect matching

Test #28:

score: 3.0303
Accepted
time: 117ms
memory: 62192kb

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:

9780 11606 2416 14894 18265 4657 9897 18628 17811 12467 18498 16317 381 16565 281 15306 3972 17059 18995 9373 13926 5676 16110 1215 861 16040 7994 12823 1646 19857 17972 18298 13087 5552 11087 16603 4518 1912 8075 9815 18223 8589 8223 11648 900 5872 15711 5626 15714 6348 18475 2864 8566 1455 15124 1...

result:

ok a perfect matching

Test #29:

score: 3.0303
Accepted
time: 95ms
memory: 61276kb

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:

1829 3762 1062 4860 5231 2819 6035 2217 3497 1688 399 90 358 5920 6334 5564 6533 4969 4728 474 3706 4545 2667 5246 3416 6064 5717 2336 4953 3733 4987 5849 3204 5836 2392 337 4512 3098 2483 1657 6191 1886 4386 4137 3074 3891 3187 1013 108 5946 176 2369 5746 4634 3876 4829 5576 63 5788 379 2584 5257 1...

result:

ok a perfect matching

Test #30:

score: 3.0303
Accepted
time: 86ms
memory: 62500kb

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:

349 213 1846 1797 829 1950 407 1384 1387 285 1063 50 943 308 1832 1716 1836 568 473 272 484 813 1470 1665 224 183 1530 1081 1119 989 218 370 45 872 1282 884 533 978 1107 594 1649 661 615 1655 313 404 603 1501 1799 1502 736 27 743 1589 1534 646 1423 1908 739 1851 1709 1303 1648 118 375 974 142 595 11...

result:

ok a perfect matching

Test #31:

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

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:

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

result:

ok a perfect matching

Test #32:

score: 3.0303
Accepted
time: 88ms
memory: 60492kb

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:

1 3 2 4

result:

ok a perfect matching

Test #33:

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

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