QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#531838 | #265. 正则二分图匹配 | orz_z | 100 ✓ | 1580ms | 247920kb | C++14 | 3.2kb | 2024-08-24 22:36:05 | 2024-08-24 22:36:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
//#define int long long
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;
#define F(i, a, b) for(int i = a; i <= (b); ++i)
#define F2(i, a, b) for(int i = a; i < (b); ++i)
#define dF(i, a, b) for(int i = a; i >= (b); --i)
template<typename T> void debug(string s, T x) {cerr << "[" << s << "] = [" << x << "]\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {for (int i = 0, b = 0; i < (int)s.size(); i++) if (s[i] == '(' || s[i] == '{') b++;else if (s[i] == ')' || s[i] == '}') b--;else if (s[i] == ',' && b == 0) {cerr << "[" << s.substr(0, i) << "] = [" << x << "] | ";debug(s.substr(s.find_first_not_of(' ', i + 1)), args...);break;}}
#ifdef ONLINE_JUDGE
#define Debug(...)
#else
#define Debug(...) debug(#__VA_ARGS__, __VA_ARGS__)
#endif
#define pb push_back
#define fi first
#define se second
#define Mry fprintf(stderr, "%.3lf MB\n", (&Med - &Mbe) / 1048576.0)
#define Try cerr << 1e3 * clock() / CLOCKS_PER_SEC << " ms\n";
typedef long long ll;
// namespace Fread {const int SIZE = 1 << 17; char buf[SIZE], *S, *T; inline char getchar() {if (S == T) {T = (S = buf) + fread(buf, 1, SIZE, stdin); if (S == T) return '\n';} return *S++;}}
// namespace Fwrite {const int SIZE = 1 << 17; char buf[SIZE], *S = buf, *T = buf + SIZE; inline void flush() {fwrite(buf, 1, S - buf, stdout), S = buf;} inline void putchar(char c) {*S++ = c;if (S == T) flush();} struct NTR {~NTR() {flush();}} ztr;}
// #ifdef ONLINE_JUDGE
// #define getchar Fread::getchar
// #define putchar Fwrite::putchar
// #endif
inline int ri() {
int x = 0;
bool t = 0;
char c = getchar();
while (c < '0' || c > '9') t |= c == '-', c = getchar();
while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
return t ? -x : x;
}
inline void wi(int x) {
if (x < 0) {
putchar('-'), x = -x;
}
if (x > 9) wi(x / 10);
putchar(x % 10 + 48);
}
inline void wi(int x, char s) {
wi(x), putchar(s);
}
bool Mbe;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3f;
const int N = 4e6 + 5;
int ans ;
int n, m ;
int vis[N] ;
int match[N] ;
vi E[N];
clock_t st ;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
db now_time(){
return (double)(clock() - st) / CLOCKS_PER_SEC ;
}
int do_match(int x){
// cout << x << ' ' ;
shuffle(E[x].begin(), E[x].end(), rnd) ; vis[x] = 1 ;
for (auto y : E[x])
if (!match[y])
return vis[x] = 0, match[y] = x, match[x] = y, 1;
for (auto y : E[x]){
int z = match[y] ;
if (vis[z]) continue;
match[x] = y, match[y] = x, match[z] = 0 ;
if (do_match(z)) return vis[x] = 0, 1;
match[y] = z, match[z] = y, match[x] = 0 ;
}
return vis[x] = 0, 0;
}
int main(){
// freopen("P6113_1.in", "r", stdin);
st = clock() ;
cin >> n >> m ; int x, y, z ;
F(i, 1, n) {
F(j, 1, m) {
x = ri();
E[i].pb(n + x), E[n + x].pb(i);
}
}
// for (int i = 1 ; i <= m ; ++ i)
// x = ri(), y = ri(), E[x].pb(y), E[y].pb(x);
while (now_time() < 0.55){
for (int i = 1 ; i <= n ; ++ i)
if (!match[i])
ans += do_match(i);
if(ans == n) break;
}
// cout << ans << '\n' ;
F(i, 1, n) printf("%d ", match[i] - n);
cout << '\n';
return 0 ;
}
詳細信息
Pretests
Final Tests
Test #1:
score: 3.0303
Accepted
time: 49ms
memory: 113840kb
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: 92ms
memory: 114012kb
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 60546 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 96606 78075 81570 68967 67263 43515 96170 90595 96142 38284...
result:
ok a perfect matching
Test #3:
score: 3.0303
Accepted
time: 60ms
memory: 107808kb
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 30528 33642 64335 3379 35131 52528 50557 15771 34506 42730 6007 28813 37494 18356 56311 17174 52076 1802 12848 59655 31765 17925 47027 18532 27065 12346 64048 25501 59559 4713 59567 52942 24055 52273 32676 39223 52012 18633 35913 12216 10239 28138 34335 28272 6746 41413 24434 43681 6160 24902 3...
result:
ok a perfect matching
Test #4:
score: 3.0303
Accepted
time: 23ms
memory: 103812kb
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:
8851 3045 1987 15335 4908 10892 15447 8112 8264 11071 5215 12192 13411 17113 12606 13513 12418 18424 18085 3116 9515 7303 4299 19504 13282 5016 1178 7596 10993 2625 1542 578 9307 2664 6546 8948 10742 13176 19832 16748 18245 1496 1374 18658 9912 3601 4655 6415 14317 12439 3869 5580 6179 2385 9609 111...
result:
ok a perfect matching
Test #5:
score: 3.0303
Accepted
time: 19ms
memory: 103724kb
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:
798 9347 3505 2349 5000 3179 7114 4862 6566 4429 487 4461 7293 5103 855 8030 9640 6070 5348 2535 5531 1116 2303 3739 6056 8533 9300 1064 1459 2256 5015 2647 5829 7855 4489 6138 169 5656 2751 7913 5468 7212 3796 2934 9795 7129 2952 1739 820 7729 5007 2049 9695 6304 7368 6898 4262 5751 5473 5365 6194 ...
result:
ok a perfect matching
Test #6:
score: 3.0303
Accepted
time: 22ms
memory: 103720kb
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:
1803 1701 3014 3539 3103 2430 3555 3688 2605 1367 2202 534 1976 1797 672 3932 3613 2894 959 296 141 444 889 3513 2331 2187 142 651 2528 1864 3355 3773 3013 3888 3507 1338 2965 3818 1264 3609 1724 2258 1722 583 744 967 3911 982 3757 3811 1036 3960 3287 1746 139 853 3991 878 3683 2510 2989 13 2754 390...
result:
ok a perfect matching
Test #7:
score: 3.0303
Accepted
time: 20ms
memory: 102216kb
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:
578 1188 1554 1383 1965 1317 299 29 1876 966 1427 1909 436 1348 216 1820 171 1593 355 597 1099 138 246 1088 1044 1277 1904 1934 43 405 892 286 412 1071 601 1993 1723 1394 602 1504 1207 1187 524 1924 590 1015 965 583 654 1493 1892 255 1307 188 495 293 1806 574 375 75 511 1953 875 1717 603 1803 442 63...
result:
ok a perfect matching
Test #8:
score: 3.0303
Accepted
time: 19ms
memory: 103500kb
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:
508 451 539 815 311 162 969 912 834 356 925 157 449 501 48 923 519 70 241 75 186 525 848 893 837 965 394 223 276 970 910 238 422 251 944 601 388 163 76 835 22 745 540 905 455 669 686 85 928 293 406 937 414 471 990 829 95 941 661 901 909 243 491 696 892 756 530 899 919 147 720 136 376 159 733 300 827...
result:
ok a perfect matching
Test #9:
score: 3.0303
Accepted
time: 15ms
memory: 104192kb
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 496 6 96 75 549 612 154 330 114 204 414 446 631 660 528 252 502 626 651 615 110 72 234 364 35 562 215 113 571 32 295 119 86 429 539 331 275 503 93 513 527 317 115 206 80 593 324 68 410 281 459 558 559 467 120 524 90 541 340 511 62 360 34 291 509 477 191 611 296 661 625 649 237 7 456 20 326 343 5...
result:
ok a perfect matching
Test #10:
score: 3.0303
Accepted
time: 16ms
memory: 102280kb
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:
13 19 14 2 18 9 1 5 11 20 16 17 10 6 7 4 3 8 15 12
result:
ok a perfect matching
Test #11:
score: 3.0303
Accepted
time: 11ms
memory: 102320kb
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: 20ms
memory: 101404kb
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: 507ms
memory: 247920kb
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: 1580ms
memory: 184380kb
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:
754950 628921 173375 609231 217216 755278 781326 439975 210831 427758 254720 568822 836016 31686 566788 321499 726558 630104 766176 117957 987876 767528 973796 94468 38853 24371 91765 642217 81723 373256 138177 522841 42217 556529 938408 232092 83664 133826 66848 793115 243028 474009 63141 276683 84...
result:
ok a perfect matching
Test #15:
score: 3.0303
Accepted
time: 529ms
memory: 144604kb
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:
230013 344559 361339 276847 14837 468748 197634 179574 182112 356066 423517 288890 191935 293747 300340 275595 113288 492497 475326 170604 397873 473670 435471 69164 498607 263970 105301 209468 200017 92277 385220 141220 315593 181407 80347 430620 484531 349403 100240 310685 368842 29643 117192 6637...
result:
ok a perfect matching
Test #16:
score: 3.0303
Accepted
time: 280ms
memory: 130644kb
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:
2631 211046 170938 126306 39270 37957 249968 135533 41703 18921 68621 3958 30882 232924 243246 128428 42219 130873 70683 61156 217018 78932 25510 151019 171785 90018 115451 126833 109626 40221 70413 219843 151800 141461 51933 225960 76129 39100 174285 235984 100200 103096 43497 164193 222265 123872 ...
result:
ok a perfect matching
Test #17:
score: 3.0303
Accepted
time: 186ms
memory: 123088kb
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:
4468 77894 33836 111107 104828 37216 118882 57067 38827 21240 117582 42632 72126 12149 28679 4889 48376 76813 30730 87454 81025 72604 11468 77567 99095 13354 83444 7112 109444 39460 76940 58333 28751 22194 27423 22073 92037 61897 109747 28966 86330 87992 124023 122136 59478 81074 58184 9149 9465 707...
result:
ok a perfect matching
Test #18:
score: 3.0303
Accepted
time: 114ms
memory: 120840kb
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:
21165 12423 15651 28186 23156 59136 25403 19700 57339 27556 5675 29410 24376 42465 25938 19648 22956 13125 39165 61032 28332 5491 50351 42220 16978 5018 42463 9721 33523 58794 30662 29099 1874 39921 5641 51379 30938 59539 32658 31455 31990 26046 5566 55554 41554 14385 14395 40294 42257 53224 4454 52...
result:
ok a perfect matching
Test #19:
score: 3.0303
Accepted
time: 59ms
memory: 117788kb
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:
10493 13863 12708 3054 4569 2900 13439 15061 13663 14210 5009 11244 5979 11585 11448 4789 13046 7277 4737 12080 3156 228 2818 600 14820 409 5552 12879 2804 13320 4750 3167 12925 5614 10125 5449 3591 6172 959 3406 14064 914 2415 14029 7721 120 3316 7787 7685 4846 14159 8248 7584 3596 2369 9420 7826 1...
result:
ok a perfect matching
Test #20:
score: 3.0303
Accepted
time: 53ms
memory: 118536kb
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:
1548 259 919 11 393 843 1807 1003 823 851 246 522 869 1185 731 604 652 569 1203 520 1702 1510 591 1094 1625 346 328 1752 1909 223 97 1214 430 1953 437 1442 1213 65 1675 1341 1743 876 23 234 1816 368 1880 1905 1262 1476 198 3 1865 579 1482 1065 1071 159 69 1605 1311 1347 538 900 1075 1786 1685 1137 6...
result:
ok a perfect matching
Test #21:
score: 3.0303
Accepted
time: 49ms
memory: 116660kb
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:
38 178 228 77 68 78 111 3 205 135 148 146 202 45 127 165 48 55 239 43 105 116 123 84 176 27 236 238 110 23 221 85 29 244 155 96 138 161 112 237 15 81 207 192 61 62 206 95 74 132 208 86 92 170 193 235 31 44 114 83 25 93 133 220 9 151 57 242 152 16 99 21 219 226 72 46 196 26 56 169 50 32 216 49 64 209...
result:
ok a perfect matching
Test #22:
score: 3.0303
Accepted
time: 43ms
memory: 116924kb
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:
11 22 2 24 1 10 5 20 9 3 6 8 15 19 21 18 26 28 17 30 29 23 16 4 13 12 25 7 14 27
result:
ok a perfect matching
Test #23:
score: 3.0303
Accepted
time: 28ms
memory: 111932kb
input:
3 524288 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
3 1 2
result:
ok a perfect matching
Test #24:
score: 3.0303
Accepted
time: 880ms
memory: 168744kb
input:
666666 3 3206 64240 199437 251202 414004 479216 133162 349551 525296 267125 278228 385799 255071 266873 648864 203529 309604 516958 227388 593079 647002 98211 414478 512085 200513 287454 395398 81231 139438 488811 180775 408644 487195 74579 149392 515012 466358 589635 620337 159618 186366 345229 255...
output:
199437 479216 349551 267125 266873 516958 647002 414478 395398 139438 180775 74579 466358 186366 255056 390433 444322 232679 491616 501690 554887 578479 122992 75664 136399 381924 578299 31353 106383 201039 260268 90267 157107 228118 11376 234239 466198 3618 244173 108473 578702 189168 482006 574277...
result:
ok a perfect matching
Test #25:
score: 3.0303
Accepted
time: 274ms
memory: 138588kb
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:
8208 52512 97887 116509 78934 101163 40537 113848 20962 193561 168666 54575 54544 151432 123863 114005 175962 1957 135952 112354 54216 5356 22123 189334 150873 109009 41521 68002 153862 133819 32320 20878 107119 117381 65307 173213 107782 181665 75886 42952 172534 146203 94478 61804 91467 157063 137...
result:
ok a perfect matching
Test #26:
score: 3.0303
Accepted
time: 179ms
memory: 132012kb
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:
5397 79627 59539 67849 89056 17858 84946 13210 2791 56767 93737 86010 64809 23625 46008 15730 31920 52217 61838 55619 53493 82422 20289 13938 37377 7492 43727 38679 42510 17950 60217 67043 36027 67363 88472 11525 2306 59888 53533 42930 47538 67527 49127 47803 42520 50280 5960 4356 40420 35887 58456 ...
result:
ok a perfect matching
Test #27:
score: 3.0303
Accepted
time: 108ms
memory: 123100kb
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:
36571 16727 23663 34290 12072 25090 4388 32979 10772 38907 23154 32208 15079 28090 11406 27172 36549 17574 10013 20522 29632 32181 29017 23966 2778 22282 30529 34667 34629 10435 2704 36123 16933 39095 7619 13300 9887 31356 761 23165 21758 26480 30458 2727 22862 28373 34893 14013 13990 31493 38150 34...
result:
ok a perfect matching
Test #28:
score: 3.0303
Accepted
time: 90ms
memory: 124056kb
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:
6725 12339 9576 4195 5983 2418 6437 1753 15992 1088 5679 9573 5968 4931 16565 15022 13321 10985 609 18523 14873 396 3561 2239 17115 7331 14591 17627 19674 16871 16370 11760 14573 4782 13809 15101 16990 5837 685 18104 1173 13568 18498 2143 13041 18818 6729 9676 18499 16365 2090 4771 17452 7787 1459 1...
result:
ok a perfect matching
Test #29:
score: 3.0303
Accepted
time: 61ms
memory: 129488kb
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:
1367 3865 3791 6238 858 2782 6612 5998 5258 2958 4404 3601 6231 5002 4846 5623 25 6280 2963 6296 1207 26 5152 6314 4774 2078 6470 2898 1722 432 5448 1518 6332 6230 3133 4206 2340 1168 6274 4564 4515 3011 3592 6390 1328 2251 302 2126 3841 5624 2248 4624 6587 224 5043 5584 3616 2544 5251 5479 6127 222...
result:
ok a perfect matching
Test #30:
score: 3.0303
Accepted
time: 43ms
memory: 117620kb
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:
622 590 1825 402 821 1652 1676 1915 772 191 724 1062 293 1554 1000 1467 161 289 1326 837 239 633 1196 461 1610 1912 822 829 987 75 1836 914 1901 1681 1441 480 1733 1919 511 1446 57 1164 1474 245 1447 1884 994 363 1116 1410 1512 1302 1854 746 1566 533 85 685 1597 1209 291 1282 1745 56 1563 1909 1570 ...
result:
ok a perfect matching
Test #31:
score: 3.0303
Accepted
time: 32ms
memory: 118452kb
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:
28 36 38 39 2 26 16 5 24 21 6 14 22 32 9 13 4 20 19 33 27 23 34 7 1 35 25 40 11 29 17 31 18 12 8 37 3 30 15 10
result:
ok a perfect matching
Test #32:
score: 3.0303
Accepted
time: 27ms
memory: 119648kb
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 3 1
result:
ok a perfect matching
Test #33:
score: 3.0303
Accepted
time: 40ms
memory: 115176kb
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