QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#480197#265. 正则二分图匹配lmeowdn#100 ✓1431ms199100kbC++141.8kb2024-07-16 10:01:212024-07-16 10:01:22

Judging History

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

  • [2024-07-16 10:01:22]
  • 评测
  • 测评结果:100
  • 用时:1431ms
  • 内存:199100kb
  • [2024-07-16 10:01:21]
  • 提交

answer

//Shirasu Azusa 2024.7
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x)  {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x)  {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x)  {return (x==0?-1:__builtin_ctzll(x));}

#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;  
typedef vector<int> vi;
typedef vector<pii> vp;
typedef tuple<int,int,int> tiii;
int read() {
  int x=0,w=1; char c=getchar(); 
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();} 
  return x*w;
}

const int N=4e6+5;
int n,d,p[N],id[N],vst[N],q[N];
vi e[N];

signed main() {
  n=read(), d=read();
  rep(i,1,n) e[i].resize(d);
  rep(i,1,n) rep(j,0,d-1) e[i][j]=read()+n;
  rep(i,1,n) id[i]=i; mt19937 rnd;
  shuffle(id+1,id+n+1,rnd);
  rep(tt,1,n) {
    int s=id[tt]; static int st[N]; int top=0;
    for(int u=s;u;) {
      while(vst[u]) {int x=st[top]; vst[x]=0; --top;}
      vst[u]=1; st[++top]=u;
      int v=e[u][rnd()%d]; while(u==p[v]) v=e[u][rnd()%d];
      while(vst[v]) {int x=st[top]; vst[x]=0; --top;}
      vst[v]=1; st[++top]=v; u=p[v];
    }
    for(int i=1;i<=top;i+=2) p[st[i]]=st[i+1], p[st[i+1]]=st[i];
    rep(i,1,top) vst[st[i]]=0;
  }
  rep(i,1,n) printf("%d ",p[i]-n); puts("");
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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: 64ms
memory: 100944kb

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 27855 7925 35131 52528 27039 37822 34506 42730 25251 4858 38602 26954 20154 10095 62088 1802 36214 57776 50927 40571 65698 62091 34209 52130 34086 25501 59559 11569 52945 37938 24055 40834 36467 48870 66265 56397 63022 10873 10239 40790 37820 16498 43328 3448 24434 62477 6160 12914 49...

result:

ok a perfect matching

Test #4:

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

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 13816 6587 1466 4818 4264 13554 9955 11071 9401 11347 13980 5931 5725 4524 15415 14672 10759 5947 18946 19530 7738 5974 5917 5016 4599 11399 1504 8235 5735 13866 4531 15323 1928 8785 3251 16806 17207 16555 10982 17929 19365 18658 9912 9803 2230 2167 14164 13187 17498 14015 3915 11416 8155...

result:

ok a perfect matching

Test #5:

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

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:

7348 1906 3376 8252 9027 4016 9161 9434 4563 9384 4597 4209 1431 9811 8675 801 6748 9965 8277 2535 8664 4590 9151 6982 9984 716 4092 7621 1459 1106 2945 6243 7963 8242 4489 1562 4083 4680 8430 1261 4530 9176 3945 2805 1516 7717 2305 4521 5608 3502 5968 8379 7191 4390 828 3872 1687 6643 5473 7749 619...

result:

ok a perfect matching

Test #6:

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

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:

3533 3743 918 2504 2807 1767 518 1771 2971 3397 1770 2601 2697 3628 2041 2437 2921 926 3951 2095 2017 2466 3993 1184 647 3648 2923 22 2616 1361 3355 3854 77 846 1331 2018 3026 84 1360 2544 510 3262 3040 713 2306 48 3949 98 310 900 894 143 508 2905 881 464 2943 3879 2166 1347 3878 170 1301 2195 2503 ...

result:

ok a perfect matching

Test #7:

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

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:

1535 388 585 1641 596 1286 157 815 1438 775 1257 443 619 456 716 1081 344 98 982 461 240 1061 401 365 355 1862 1004 1011 1325 1879 869 1988 25 139 463 1268 1840 843 748 303 1007 701 978 1501 1717 271 1820 286 907 1681 638 297 1718 1103 285 1556 111 282 549 471 683 798 1493 1821 80 1537 273 235 745 1...

result:

ok a perfect matching

Test #8:

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

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:

659 466 721 210 594 503 988 91 340 342 36 630 40 406 541 87 401 227 172 551 24 973 631 414 390 800 824 205 705 591 184 854 463 989 604 302 767 199 757 458 884 830 320 810 644 860 600 99 553 761 306 488 648 471 960 434 500 224 182 565 603 897 655 899 481 468 691 987 612 517 728 747 994 365 265 88 827...

result:

ok a perfect matching

Test #9:

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

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:

604 140 11 497 662 12 237 129 369 597 89 231 175 298 227 376 142 549 482 150 442 644 449 545 427 236 97 145 436 390 51 107 133 448 649 407 546 534 450 245 50 332 340 532 28 226 25 14 391 34 575 119 370 357 24 323 75 529 118 225 307 166 360 648 429 7 626 58 426 665 570 466 254 577 638 538 584 44 85 1...

result:

ok a perfect matching

Test #10:

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

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:

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

result:

ok a perfect matching

Test #11:

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

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

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: 389ms
memory: 199100kb

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: 1431ms
memory: 153536kb

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 905137 189618 616699 54080 117957 695703 178663 977706 94468 840677 451100 227766 642217 660136 373256 294316 522841 42217 556529 736226 232092 398160 133826 66848 793115 243028 726017 248166 584152...

result:

ok a perfect matching

Test #15:

score: 3.0303
Accepted
time: 595ms
memory: 122972kb

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:

254334 61228 441492 276847 305018 468748 49634 179574 141683 356066 247869 290882 160039 184280 6306 157628 481256 383179 110698 170604 230363 404653 435471 69164 23604 41512 129864 392417 54824 229004 85438 29385 315593 475283 414682 110967 97132 73284 100240 58641 141981 110229 20598 66371 62698 3...

result:

ok a perfect matching

Test #16:

score: 3.0303
Accepted
time: 299ms
memory: 114036kb

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:

180005 99955 151789 239399 39270 37957 88026 150679 172972 18921 21290 236846 108439 5544 135251 128428 177833 36122 199939 148407 7380 238410 25510 161898 214765 211276 107203 159416 190349 205400 83434 46350 247441 141461 51933 164215 149135 145601 174285 235984 153546 80383 20212 171095 123881 22...

result:

ok a perfect matching

Test #17:

score: 3.0303
Accepted
time: 139ms
memory: 109768kb

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:

1740 111456 10180 25560 91897 30637 89608 8984 103154 105537 36156 116816 122385 12149 13908 68402 77313 171 102635 72724 41640 76128 58065 96903 65864 13354 3987 7112 58257 53197 61440 53462 8351 37584 71989 7777 88710 95820 46547 114787 106895 87992 124023 31491 29028 46528 66681 86396 72668 82164...

result:

ok a perfect matching

Test #18:

score: 3.0303
Accepted
time: 82ms
memory: 107488kb

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:

22795 60424 27394 53071 30466 61021 33025 4728 57879 48399 41849 47325 21447 14156 1709 25299 40660 50841 50567 58509 25433 60356 5179 7061 16978 9854 15986 17552 30807 1014 16260 52796 31312 18526 50057 4406 11562 12869 36040 43156 30426 37998 6795 22614 57097 58284 4069 8890 12198 40719 37026 6286...

result:

ok a perfect matching

Test #19:

score: 3.0303
Accepted
time: 49ms
memory: 105832kb

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:

4267 3730 6219 14509 12644 10674 3012 6908 4719 10934 5627 12576 6430 2238 8427 6997 5175 8679 4737 1213 3006 12145 4761 7769 8701 13155 6259 7657 1693 4802 696 2409 10271 7271 11024 2063 2940 2004 3578 1347 14797 11594 15389 12721 13293 4303 1774 1210 8921 12459 8148 2720 70 2537 7866 1585 13942 13...

result:

ok a perfect matching

Test #20:

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

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:

409 251 238 1175 793 1098 1187 1047 768 395 801 1606 461 494 41 1549 1814 1031 732 1127 1014 455 1942 1274 275 418 606 1801 92 1521 161 716 1931 1648 932 750 122 1924 1949 798 851 470 336 312 188 758 852 1734 1271 576 570 1792 832 366 447 1673 151 1233 1864 1590 74 822 637 1337 369 1188 1569 554 765...

result:

ok a perfect matching

Test #21:

score: 3.0303
Accepted
time: 43ms
memory: 105368kb

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:

232 33 159 119 58 25 149 92 88 62 71 224 39 18 27 13 130 237 238 51 229 37 200 222 59 12 126 49 6 10 136 125 217 192 221 35 118 100 160 161 181 188 21 19 195 166 4 157 22 197 146 152 57 48 133 171 185 40 143 113 24 11 43 86 78 31 17 150 117 179 243 187 154 30 223 172 55 162 234 168 103 73 72 93 175 ...

result:

ok a perfect matching

Test #22:

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

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:

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

result:

ok a perfect matching

Test #23:

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

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: 884ms
memory: 131384kb

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 133162 385799 255071 203529 647002 414478 287454 488811 487195 515012 620337 159618 455975 203276 231281 232679 491616 135998 554887 578479 122992 647784 265475 224107 239426 271801 106383 347660 99555 360589 160239 228118 11376 234239 165004 3618 477197 293900 181409 189168 95016 48258...

result:

ok a perfect matching

Test #25:

score: 3.0303
Accepted
time: 275ms
memory: 110756kb

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 89617 2825 45893 185275 153810 195456 63100 151284 144951 178507 33943 69136 193722 123863 74364 128130 120074 99112 112354 54216 5514 22123 61038 183772 54403 146847 162706 125895 31335 32320 146660 141825 81049 151026 173968 109164 175867 11884 42952 142310 31478 196636 52166 157429 137710 1...

result:

ok a perfect matching

Test #26:

score: 3.0303
Accepted
time: 121ms
memory: 108864kb

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:

88672 25953 87049 73993 89056 84675 94415 60224 10980 29713 27516 5876 16495 25403 46755 74552 87856 3478 1852 60201 87139 60604 37456 90825 5190 18694 55770 86670 87947 32359 15910 70860 13218 74005 36444 73551 46463 10412 89746 68868 64153 2909 91113 92476 6684 21808 27483 48924 59182 34216 13909 ...

result:

ok a perfect matching

Test #27:

score: 3.0303
Accepted
time: 68ms
memory: 106468kb

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:

23012 16727 15480 12771 2360 8290 26396 8219 25616 33405 14392 25852 5569 9726 11376 38522 16752 28753 31484 1685 5396 10575 3717 28795 9292 29062 31960 27325 3513 35192 16154 21950 35242 33738 28916 19785 33430 5916 743 26662 33431 12301 2146 2727 18004 12003 5489 17506 18615 20938 30903 18468 1366...

result:

ok a perfect matching

Test #28:

score: 3.0303
Accepted
time: 50ms
memory: 105984kb

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 4767 10188 10034 13779 1522 11926 6761 15466 1808 19954 14564 12677 19490 5942 14383 5461 11359 8778 6664 1914 9365 17040 11428 12910 9814 1518 10140 12813 669 7058 18719 11077 13881 15596 2876 4887 14810 13287 7235 1015 13346 19288 18849 11670 4504 18101 3151 1084 1175 12772 10126 18645 15254 4...

result:

ok a perfect matching

Test #29:

score: 3.0303
Accepted
time: 49ms
memory: 105604kb

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:

2610 1709 4743 367 976 4055 3971 3423 6492 41 63 2602 4485 2104 2703 1763 1054 3122 1028 3800 3469 6627 262 5102 5290 3788 5647 5555 6615 5522 5848 5635 2001 4958 4646 5604 4951 4517 232 3727 5065 4599 6423 1588 5511 29 3400 5997 6390 3720 4611 4451 5783 1342 6090 354 6338 3807 1613 5093 5041 4676 3...

result:

ok a perfect matching

Test #30:

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

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:

1127 641 1891 1426 482 1145 101 1929 582 97 1807 421 337 306 1979 1101 389 648 2000 1102 902 1510 904 577 1956 1306 1449 875 1863 1550 552 250 735 1262 1682 1372 814 721 1828 1170 998 1721 1097 396 259 1013 73 1293 772 1124 459 1939 1585 1434 1843 1394 449 812 823 960 782 1535 703 1266 583 8 411 695...

result:

ok a perfect matching

Test #31:

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

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:

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

result:

ok a perfect matching

Test #32:

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

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

result:

ok a perfect matching

Test #33:

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

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