QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#367625 | #2369. Joint Excavation | kevinyang# | AC ✓ | 210ms | 81476kb | C++17 | 2.2kb | 2024-03-26 10:54:10 | 2024-03-26 10:54:11 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mxn = 200005;
vector<vector<int>>g(mxn);
vector<vector<int>>adj(mxn);
vector<bool>vis(mxn);
vector<int>sz(mxn);
set<int>leftv;
vector<int>ans;
int rq = 0;
void dfs(int u){
sz[u] = 1;
for(int nxt: adj[u]){
if(vis[nxt])continue;
g[u].push_back(nxt);
vis[nxt] = true;
dfs(nxt);
sz[u]+=sz[nxt];
}
}
set<int> get(int u, int p){
set<int>s;
s.insert(u);
for(int nxt: g[u]){
set<int>t = get(nxt,u);
if(s.size()<t.size()){
swap(s,t);
}
for(int nxt: t){
s.insert(nxt);
}
}
return s;
}
void dfs1(int u, int p){
if(rq == sz[u]*2){
for(int nxt: get(u, p)){
leftv.insert(nxt);
}
return;
}
rq--;
ans.push_back(u);
vector<pair<int,int>>vals;
for(int nxt: g[u]){
vals.push_back({sz[nxt],nxt});
}
if(rq==0){
return;
}
sort(vals.begin(),vals.end());
for(auto [_, nxt]: vals){
if(rq >= sz[nxt]*2){
//cout << "found " << '\n';
rq-=sz[nxt]*2;
for(int node: get(nxt, p)){
//cout << "get " << nxt << '\n';
leftv.insert(node);
}
if(rq==0)return;
continue;
}
dfs1(nxt, u);
return;
}
}
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
vis[1] = true;
int n,m;
cin >> n >> m;
for(int i = 0; i<m; i++){
int x,y;
cin >> x >> y;
adj[x].push_back(y);
adj[y].push_back(x);
}
rq = n;
dfs(1);
dfs1(1,0);
cout << ans.size() << ' ' << (n-ans.size())/2 << '\n';
set<int>right;
for(int i = 1; i<=n; i++){
right.insert(i);
}
for(int i = 0; i<ans.size(); i++){
right.erase(ans[i]);
cout << ans[i];
if(i+1<ans.size())cout << ' ';
}
for(int nxt: leftv){
right.erase(nxt);
}
cout << '\n';
assert(leftv.size() == right.size());
if((n-ans.size())/2){
vector<int>vec;
for(int nxt: leftv){
vec.push_back(nxt);
}
for(int i = 0; i<vec.size(); i++){
cout << vec[i];
if(i+1<vec.size())cout << ' ';
}
cout << '\n';
vec.clear();
for(int nxt: right){
vec.push_back(nxt);
}
for(int i = 0; i<vec.size(); i++){
cout << vec[i];
if(i+1<vec.size())cout << ' ';
}
cout << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 13764kb
input:
1 0
output:
1 0 1
result:
ok
Test #2:
score: 0
Accepted
time: 4ms
memory: 14268kb
input:
20 25 17 14 5 14 3 18 14 2 13 4 18 8 18 20 2 20 2 1 2 19 2 10 4 10 4 15 20 1 20 19 20 10 10 1 10 19 1 19 1 6 19 9 6 11 6 12 9 16 9 7
output:
4 8 1 2 20 18 3 5 6 8 11 12 14 17 4 7 9 10 13 15 16 19
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 14268kb
input:
20 22 19 6 11 6 2 6 6 15 15 13 13 12 12 7 7 15 15 12 7 13 3 14 8 14 20 14 14 13 12 5 5 18 5 9 5 4 7 16 16 17 16 10 16 1
output:
6 7 1 16 7 12 13 14 3 4 5 9 10 17 18 2 6 8 11 15 19 20
result:
ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 14308kb
input:
63 119 48 45 45 41 15 58 23 43 18 42 41 1 33 20 26 6 18 12 34 17 5 24 2 61 62 11 16 27 6 14 39 47 39 19 29 52 22 41 33 36 31 28 10 28 2 32 54 56 32 45 57 25 51 26 7 32 43 58 1 25 9 58 3 40 53 12 41 46 6 3 37 15 24 4 54 4 41 25 7 45 5 4 48 63 30 13 36 19 44 13 3 18 19 29 62 17 32 61 47 34 32 44 2 8 5...
output:
29 17 1 41 45 48 63 61 2 32 7 25 57 17 34 47 39 19 36 21 26 6 3 40 13 30 24 5 4 54 56 8 11 14 20 22 29 33 35 44 46 49 51 52 55 59 60 62 9 10 12 15 16 18 23 27 28 31 37 38 42 43 50 53 58
result:
ok
Test #5:
score: 0
Accepted
time: 2ms
memory: 14608kb
input:
1000 3000 769 860 860 945 945 136 136 665 665 266 266 549 549 917 917 404 404 591 591 336 336 749 749 17 17 129 129 870 870 472 591 126 126 740 740 397 397 894 894 582 582 939 939 22 22 947 947 21 21 277 277 607 607 538 538 634 634 154 154 220 220 615 21 455 455 202 202 47 47 748 748 620 620 367 367...
output:
718 141 1 792 566 324 722 499 443 71 367 620 748 47 202 455 21 947 22 939 582 894 397 740 126 591 404 917 549 266 665 136 945 860 769 332 959 606 848 942 288 221 918 632 461 762 544 564 439 709 154 634 538 607 277 613 162 532 569 64 673 755 602 605 417 868 624 680 237 333 736 790 548 562 210 77 819 ...
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 14488kb
input:
1000 4000 464 484 484 988 988 735 735 247 247 269 269 16 16 46 46 40 40 543 543 236 236 107 107 660 660 58 58 270 270 705 705 161 161 797 797 444 444 395 395 710 710 488 488 162 162 202 202 353 353 430 430 804 804 371 371 47 47 819 819 566 566 92 270 275 275 860 860 208 208 704 704 580 580 317 317 6...
output:
802 99 1 681 697 341 914 982 415 961 161 705 270 58 660 107 236 543 40 46 16 269 247 735 988 484 464 70 266 327 237 272 240 903 261 647 752 891 818 21 278 629 936 750 869 513 227 894 174 103 224 827 72 315 831 944 844 120 10 952 787 282 690 308 214 795 215 642 904 87 822 644 861 912 540 486 784 329 ...
result:
ok
Test #7:
score: 0
Accepted
time: 6ms
memory: 14540kb
input:
1000 6000 1000 60 60 97 97 994 994 431 431 393 393 698 698 447 447 254 254 450 450 669 669 480 480 436 436 354 354 243 243 33 33 182 182 632 632 212 212 445 445 303 303 404 404 199 199 427 427 746 746 259 259 724 724 892 892 170 170 655 655 634 634 342 342 914 914 387 387 336 336 2 2 255 255 91 91 6...
output:
846 77 1 740 335 536 751 601 890 147 647 549 241 390 934 659 234 423 770 510 391 825 80 587 57 297 263 358 526 209 268 618 66 633 91 255 2 336 387 914 342 634 655 170 892 724 259 746 427 199 404 303 445 212 632 182 33 243 354 436 480 669 450 254 447 698 393 431 994 97 60 1000 159 440 500 285 525 857...
result:
ok
Test #8:
score: 0
Accepted
time: 0ms
memory: 14440kb
input:
1000 8000 723 869 869 902 902 390 390 285 285 457 457 165 165 523 523 242 242 164 164 104 104 178 178 440 440 641 641 585 585 240 240 254 254 727 727 64 64 977 977 684 684 116 116 18 18 942 942 519 519 302 302 764 764 586 586 675 675 594 594 726 726 45 45 648 648 69 69 299 299 81 81 889 889 425 81 9...
output:
872 64 1 680 442 327 911 953 744 493 777 322 899 718 844 700 864 300 57 26 459 27 177 257 966 995 204 90 593 975 551 968 84 445 538 943 991 286 87 7 162 760 756 915 81 299 69 648 45 726 594 675 586 764 302 519 942 18 116 684 977 64 727 254 240 585 641 440 178 104 164 242 523 165 457 285 390 902 869 ...
result:
ok
Test #9:
score: 0
Accepted
time: 3ms
memory: 14528kb
input:
1000 10000 218 188 188 791 791 374 374 366 366 572 572 625 625 522 522 568 568 329 329 92 92 12 12 288 288 944 944 624 624 918 918 711 711 945 945 478 478 846 846 139 139 136 136 967 967 873 873 528 528 674 674 62 62 767 767 866 866 116 116 505 505 354 354 48 48 898 898 712 712 611 611 192 192 35 35...
output:
912 44 1 819 113 928 499 551 51 677 32 16 744 190 541 417 915 177 656 887 836 327 929 391 55 922 139 846 478 945 711 918 624 944 288 12 92 329 568 522 625 572 366 374 791 188 218 995 319 123 916 40 414 834 434 555 543 622 432 507 636 671 353 534 210 639 459 533 281 361 958 343 779 587 884 433 548 64...
result:
ok
Test #10:
score: 0
Accepted
time: 185ms
memory: 81440kb
input:
200000 200000 83736 8620 8620 193491 193491 152920 152920 20226 20226 21325 21325 140636 140636 32002 32002 80195 80195 108452 108452 168632 168632 106932 106932 60351 60351 122355 122355 17534 17534 128475 128475 94201 94201 152737 152737 110541 110541 36311 36311 139536 139536 140677 140677 106929...
output:
200000 0 1 54280 68907 163261 97690 39204 197198 169932 138588 194458 140199 12623 122590 151883 184443 194236 48461 40472 187248 127218 98273 171147 49973 188359 175643 105370 14325 117245 28846 125735 20216 191662 28053 187816 27799 99415 184359 50831 35123 4821 147703 187142 164206 111559 111436 ...
result:
ok
Test #11:
score: 0
Accepted
time: 21ms
memory: 19784kb
input:
632 199396 610 33 262 576 194 573 384 105 380 233 413 271 58 364 323 515 91 617 556 263 248 611 354 399 518 455 550 560 518 472 575 474 196 618 377 279 301 620 497 27 579 302 223 24 524 334 342 388 371 74 436 450 357 167 427 531 574 292 260 472 140 419 586 295 79 149 328 368 107 535 366 205 281 90 1...
output:
632 0 1 531 427 31 219 209 40 14 334 524 627 289 174 618 196 153 437 32 300 577 228 73 283 224 435 565 368 328 292 574 474 575 184 264 43 494 468 387 246 469 470 110 274 622 91 617 376 297 281 90 82 84 230 321 191 552 55 492 629 151 533 378 62 19 273 310 290 563 256 386 592 30 131 352 626 229 299 69...
result:
ok
Test #12:
score: 0
Accepted
time: 76ms
memory: 26184kb
input:
65535 131053 13817 11318 28659 34410 63271 15489 10084 63422 29749 57061 5867 26307 40175 32419 31340 13345 5136 33192 22203 64781 2465 53037 29628 13153 19198 26402 61161 54218 59819 20888 59221 24146 41674 37869 56244 62743 49261 1769 18689 39049 30380 46073 17387 35260 30443 47811 5353 53750 3246...
output:
4527 30504 1 52022 42862 64647 55428 4519 45166 54736 52718 22035 47774 7604 62026 40319 23467 60836 33851 63172 20556 63804 13278 53049 59973 38380 58189 45799 49986 3009 7559 40142 21014 4992 48685 35481 8245 12769 29787 30163 17296 22837 29282 29564 58384 41481 36145 13666 26160 65225 2090 25057 ...
result:
ok
Test #13:
score: 0
Accepted
time: 189ms
memory: 47616kb
input:
190308 196044 157204 39611 62105 35612 111214 49950 85675 58461 90288 46652 128076 87202 21059 53523 72705 171266 106292 53461 42056 170541 158033 33735 26509 33264 133076 26361 121026 188201 72666 55549 47392 95463 105121 64880 186671 99295 144287 155507 126374 11188 116401 33541 182453 19740 13871...
output:
33946 78181 1 133620 98003 129522 12314 117976 17450 93911 91854 67176 187527 11067 132944 119011 76899 29600 102708 53430 51105 105891 6471 74590 10080 153182 60299 110159 173814 138523 60020 183470 138411 183706 188312 19317 72518 50918 48097 94542 25610 64772 83452 24077 168202 100115 176377 1676...
result:
ok
Test #14:
score: 0
Accepted
time: 182ms
memory: 46380kb
input:
189204 194181 110380 112615 113412 71782 185972 117446 90208 77789 138638 181920 26086 126672 5551 16997 116879 28844 143629 101554 68409 6220 9904 15718 78941 96952 155642 80965 75426 177792 17590 129749 9414 107459 77182 80008 183488 97712 146496 511 92124 56877 63774 83306 100503 99589 81295 1408...
output:
23420 82892 1 24470 26651 90247 169672 127984 102366 92204 133030 56751 167245 99422 118577 144792 174621 176743 58851 108825 81781 16152 119779 92038 86564 182697 66324 181830 73319 142760 20264 75140 171992 159714 144919 63191 52815 93702 116640 154886 86038 97795 14812 148686 47549 48969 166553 8...
result:
ok
Test #15:
score: 0
Accepted
time: 90ms
memory: 34028kb
input:
57648 199488 14726 1463 52862 17799 6336 30992 45880 6125 51562 25253 50289 19155 56581 28305 45085 41899 15056 55542 42722 55511 24319 3706 20643 47759 34125 17669 37474 49598 39972 9491 50424 8209 9453 15012 25327 51991 14267 12040 17388 52424 52756 2185 34092 18767 43182 24723 35763 23161 3170 28...
output:
42350 7649 1 18008 42090 34000 14443 12232 21102 10736 399 7674 36881 5518 43923 6686 50096 18120 34469 29120 31452 12236 25719 39023 28310 14816 43277 2898 48669 13501 55334 18422 48321 47083 3796 5777 16341 9961 33520 39030 52821 19022 34952 51481 36742 13608 52805 6829 14772 51976 16337 4580 2964...
result:
ok
Test #16:
score: 0
Accepted
time: 83ms
memory: 35316kb
input:
66715 199766 17587 30731 56632 16887 37051 5460 29252 58741 11869 56157 5040 51436 57858 47385 60636 9840 11275 42938 59593 21006 25647 44467 55570 9558 21851 12902 41386 34882 56453 9677 413 26389 26081 53713 22784 12564 42337 39787 57107 44572 52041 603 13696 29927 65508 46378 55 40192 56977 51133...
output:
43575 11570 1 65742 40883 49670 47325 35328 34817 56424 66489 20312 21940 18513 29867 38569 39173 43900 35208 8581 9432 24746 38166 7610 11176 60569 24264 23017 9458 41854 9322 1907 65673 47801 39513 24442 28570 44012 66158 29452 17033 45426 2122 20956 16664 19772 11790 16534 31653 30567 41098 65231...
result:
ok
Test #17:
score: 0
Accepted
time: 210ms
memory: 50780kb
input:
190170 195465 2629 125899 162916 165958 140025 71443 152618 170663 174033 138921 67725 126246 120076 177041 91319 5047 117819 142413 37205 53432 171796 33846 61342 125907 88594 39102 182746 60081 142048 112062 15971 86835 114218 141326 173779 185185 51992 105887 120144 2227 153978 1114 171754 64620 ...
output:
50404 69883 1 17217 7658 68083 9233 118478 79076 181671 127597 153336 6014 137471 1628 155869 108148 125923 177143 137902 137426 169560 152960 30432 107780 65632 113413 131418 30115 111822 125123 143758 81406 64190 143949 138899 157874 190090 63622 170706 184602 174274 38364 140339 165692 180087 168...
result:
ok
Test #18:
score: 0
Accepted
time: 188ms
memory: 49232kb
input:
189899 194541 170612 170993 144332 29034 17001 11340 69410 66705 74273 12178 28034 174156 111274 144547 24203 65035 158558 29767 163387 22891 87727 78790 94757 9058 17327 49332 127605 122013 38015 174772 35582 157839 152303 133417 171695 156575 2328 2463 53636 160820 119381 799 41843 40671 94397 354...
output:
43079 73410 1 183276 114049 177545 71268 42042 172767 56853 51169 152975 153166 168267 12209 142979 165754 97958 150699 33245 123646 118709 178925 56174 78036 39817 121106 178613 178945 107535 97788 172592 188817 113755 174564 107944 68916 59178 138946 6586 147991 179161 189411 18029 100783 143549 5...
result:
ok
Test #19:
score: 0
Accepted
time: 84ms
memory: 34852kb
input:
61835 199331 18415 32775 61599 39208 11698 9837 29738 61808 55273 52808 19751 13058 40241 49183 533 24526 3687 30484 40337 35246 48445 57967 30675 16995 14197 42359 44535 28478 35124 42116 4345 48134 41451 53821 14105 25917 268 58877 51604 15465 42398 18952 7444 15980 41684 27200 45351 24537 37529 2...
output:
45693 8071 1 44847 56057 14844 9730 56588 53700 38920 35482 22540 44553 12178 49359 26463 54056 7637 11777 13993 9697 7286 8644 27560 33073 24986 16416 2959 20627 39496 38838 55958 2117 13423 35435 44663 33346 5495 21492 35779 30328 27939 29258 41000 17612 30214 5119 1294 4677 38354 3677 45453 58362...
result:
ok
Test #20:
score: 0
Accepted
time: 75ms
memory: 35016kb
input:
63337 199846 21418 52942 49451 23039 43718 45542 45918 41836 23920 47377 6180 21276 18798 25133 9930 31002 25244 54794 51681 12102 46163 34345 41833 33011 31769 26535 16578 47808 14938 6954 22712 52756 56846 25865 54863 10369 52324 49721 52481 23924 48066 50589 54956 58372 17311 45592 55921 50583 36...
output:
45153 9092 1 54291 8738 18072 2475 20664 43749 17444 8604 12689 42429 49632 41589 48844 55642 9594 35354 11258 54403 29663 31653 34929 49483 47879 32516 40161 23069 43990 3101 15552 38296 35822 9401 21130 46094 16038 39963 59180 12534 17799 4170 54675 34291 61733 9872 52113 55077 44171 27652 16005 6...
result:
ok
Test #21:
score: 0
Accepted
time: 188ms
memory: 40844kb
input:
200000 200000 10465 69937 69937 14729 14729 55961 55961 56619 56619 41166 41166 126257 126257 170152 170152 146252 146252 14017 14017 196651 196651 41107 41107 192888 192888 109152 109152 286 286 151318 151318 171322 171322 60562 60562 144557 144557 196342 196342 70875 70875 131680 131680 72498 7249...
output:
944 99528 1 87954 93664 66046 105775 157522 21726 53944 18426 78960 51882 132348 22095 171498 182050 141013 94989 166455 112283 146594 83045 3732 16344 85660 123941 7968 1017 157125 187929 55896 37318 103653 122241 64643 91413 187528 52533 123623 166627 7854 31415 109827 163899 177255 179138 24643 1...
result:
ok
Test #22:
score: 0
Accepted
time: 37ms
memory: 22148kb
input:
10000 200000 7470 4692 4692 7557 7557 5180 5180 2042 2042 3794 3794 374 374 7669 7669 9184 9184 6531 6531 2182 2182 3784 3784 5512 5512 8951 8951 9285 9285 9223 9223 2640 2640 6962 6962 3994 3994 4280 4280 6292 6292 4638 4638 2354 2354 4771 4771 5695 5695 690 690 517 517 8184 8184 751 751 4116 4116 ...
output:
9588 206 1 7428 292 9341 9997 7126 205 1043 6397 6844 4602 3763 5648 3448 3427 7376 9853 4061 2993 194 5138 6665 8226 545 6096 2719 6387 5 3337 2096 4276 8778 7078 7881 3063 9474 2253 7778 2219 8478 5126 199 6258 2118 4747 6623 1272 4103 273 5848 2274 2190 8834 9198 6557 1235 4965 8595 8776 7571 397...
result:
ok
Test #23:
score: 0
Accepted
time: 171ms
memory: 39856kb
input:
192868 192867 149430 18345 18345 34346 34346 76193 76193 13133 13133 178290 178290 121695 121695 16199 16199 3138 3138 137097 137097 118812 118812 99316 99316 30191 30191 78550 78550 111582 111582 120756 120756 5960 5960 88801 88801 93958 93958 70959 70959 5776 5776 128695 128695 35159 35159 25369 2...
output:
378 96245 1 183794 50057 163986 54360 189073 85205 26001 123640 64420 41879 108726 23890 136239 100431 112912 168670 60910 8193 163839 106617 126031 15788 190059 117726 43171 182101 36257 85784 51481 158599 146014 123551 24861 2770 55711 117637 8755 77539 123753 80833 32135 8479 67462 81270 83485 16...
result:
ok
Test #24:
score: 0
Accepted
time: 27ms
memory: 22260kb
input:
10000 200000 6480 5298 5298 7889 7889 4860 4860 7131 7131 7686 7686 5823 5823 6283 6283 7613 7613 7349 7349 3977 3977 7037 7037 6318 6318 3530 3530 5504 5504 8193 8193 7546 7546 7563 7563 3251 3251 8911 8911 5605 5605 3915 3915 635 635 6217 6217 8392 8392 4355 4355 8513 8513 675 675 9650 9650 267 26...
output:
9550 225 1 6286 3725 5587 8453 8195 9987 4133 6936 3536 8269 2308 5104 5933 3521 9272 440 7916 7971 9376 3284 4341 2133 9743 3148 3860 7843 3154 5268 4078 7336 5394 9410 2576 3433 4245 7922 9983 8674 4485 4531 1248 591 8192 4617 743 5462 4352 3243 9103 9834 6474 8710 1528 5014 3047 8928 1332 6529 27...
result:
ok
Test #25:
score: 0
Accepted
time: 31ms
memory: 20920kb
input:
5000 200000 3254 2589 2589 2644 2644 1877 1877 4910 4910 1176 1176 3423 3423 1392 1392 434 434 1488 1488 4175 4175 84 84 3476 3476 3348 3348 3377 3377 1950 1950 2340 2340 3213 3213 2182 2182 2684 2684 4165 4165 3741 3741 3699 3699 1050 1050 3121 3121 522 522 4705 4705 4885 4885 4227 4227 2677 2677 3...
output:
4890 55 1 111 4681 1104 3435 3731 4053 1247 1345 479 322 1698 4618 4009 3519 2550 3377 3348 3476 84 4175 1488 434 1392 3423 1176 4910 1877 2644 2589 3254 134 2986 2898 1853 3378 2166 2492 444 1745 3308 2283 2486 2173 3616 901 781 3249 4614 1264 4438 4031 2174 3154 3287 3619 732 817 586 760 2548 3913...
result:
ok
Test #26:
score: 0
Accepted
time: 96ms
memory: 81476kb
input:
200000 199999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 ...
output:
200000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...
result:
ok
Test #27:
score: 0
Accepted
time: 86ms
memory: 81356kb
input:
200000 199999 200000 199999 199999 199998 199998 199997 199997 199996 199996 199995 199995 199994 199994 199993 199993 199992 199992 199991 199991 199990 199990 199989 199989 199988 199988 199987 199987 199986 199986 199985 199985 199984 199984 199983 199983 199982 199982 199981 199981 199980 199980...
output:
200000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...
result:
ok
Test #28:
score: 0
Accepted
time: 196ms
memory: 79004kb
input:
200000 199999 152735 36834 36834 146215 146215 93059 93059 28002 28002 57147 57147 116744 116744 91899 91899 102349 102349 64373 64373 157271 157271 175204 175204 58636 58636 26665 26665 192069 192069 36653 36653 51824 51824 90366 90366 41647 41647 880 880 74117 74117 50073 50073 85090 85090 74269 7...
output:
187982 6009 1 152078 9158 184972 82074 62439 160418 116584 103428 62062 6525 27753 146431 165345 83044 85143 45662 89479 199121 49492 11728 88687 165319 163928 127727 121140 48147 143248 122738 5393 69519 142338 161332 175613 191660 176088 32574 61728 9450 74552 14720 114269 62279 135335 19967 33839...
result:
ok
Test #29:
score: 0
Accepted
time: 4ms
memory: 15752kb
input:
10000 9999 5641 5640 2226 2225 5834 5833 4168 4167 2875 2874 3866 3867 2522 2521 5185 5184 1709 1708 842 843 3247 3248 9171 9170 418 417 34 35 9263 9262 534 535 8146 8145 2149 2150 1595 1594 3089 3088 4583 4584 2392 2391 6009 6010 7289 7288 5396 5395 4266 4267 6761 6760 4727 4728 4799 4798 5355 5356...
output:
100 4950 1 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009...
result:
ok
Test #30:
score: 0
Accepted
time: 119ms
memory: 40772kb
input:
200000 199999 112118 112117 34017 34016 101554 101553 5570 5569 69681 69682 66829 66830 21747 21748 102033 102034 64212 64211 64314 64315 31287 31286 86829 86830 125050 125051 23070 23069 168832 168833 90328 90327 177704 177703 153602 153601 168546 168547 70205 70204 1769 1768 60884 60883 63332 6333...
output:
258 99871 1 99683 99684 99685 99686 99687 99688 99689 99690 99691 99692 99693 99694 99695 99696 99697 99698 99699 99700 99701 99702 99703 99704 99705 99706 99707 99708 99709 99710 99711 99712 99713 99714 99715 99716 99717 99718 99719 99720 99721 99722 99723 99724 99725 99726 99727 99728 99729 99730 ...
result:
ok
Test #31:
score: 0
Accepted
time: 0ms
memory: 14244kb
input:
1000 4330 42 860 429 826 869 874 805 978 728 186 880 522 774 226 806 499 514 687 583 689 703 423 849 829 902 528 555 770 394 623 738 310 87 177 357 724 197 280 625 417 2 512 556 530 168 520 219 791 519 833 557 750 957 904 551 533 225 115 424 657 89 715 920 175 281 488 533 392 769 656 972 202 40 433 ...
output:
24 488 1 266 21 489 300 66 248 47 385 785 741 755 530 556 119 714 643 768 140 376 500 82 378 825 2 3 6 7 8 9 10 14 15 16 18 19 20 22 24 25 28 30 31 33 37 38 39 44 48 49 53 55 62 64 65 67 68 70 71 73 75 76 77 78 80 83 84 85 86 87 88 89 93 96 102 104 107 108 110 111 113 115 117 118 120 121 123 124 126...
result:
ok
Test #32:
score: 0
Accepted
time: 6ms
memory: 14472kb
input:
1001 5000 981 46 705 536 493 918 424 112 529 920 765 775 688 158 115 64 975 751 426 387 89 880 845 167 742 977 803 670 199 682 335 135 264 786 1 309 579 582 609 19 843 1000 212 971 317 826 372 364 917 452 588 120 892 996 477 752 499 348 263 471 933 561 690 434 158 682 458 692 718 204 365 17 432 929 ...
output:
109 446 1 309 517 290 962 4 738 130 605 465 756 711 150 736 902 101 980 838 549 60 889 100 710 163 35 394 134 11 740 159 661 138 316 623 803 670 663 564 703 193 821 909 492 280 397 23 502 640 329 775 765 618 936 176 125 22 214 299 328 741 534 282 815 374 746 259 950 89 880 366 739 925 906 325 446 60...
result:
ok
Test #33:
score: 0
Accepted
time: 3ms
memory: 14484kb
input:
1500 6000 229 979 206 199 1177 389 693 283 1430 1362 822 529 602 654 1195 1308 567 593 1400 366 1400 1330 1231 1170 828 747 393 144 949 765 1263 633 1123 1022 824 1190 162 644 1172 620 613 800 760 334 49 277 924 567 20 742 1201 914 1362 1388 785 940 1252 661 910 985 1293 1198 653 514 1199 1310 1396 ...
output:
124 688 1 578 193 159 1043 450 1325 142 868 406 1369 77 584 1467 1268 1185 1319 210 942 170 977 320 1223 191 508 637 611 158 182 235 247 294 1408 392 1290 1116 14 602 654 1074 273 321 317 1002 840 706 823 1243 663 535 975 448 859 446 621 660 857 769 211 58 1250 474 257 512 999 732 153 1245 121 919 7...
result:
ok
Test #34:
score: 0
Accepted
time: 22ms
memory: 17652kb
input:
10003 95661 8092 6584 545 4577 4169 7949 7557 830 2156 2824 8860 6413 9673 4215 1503 9603 2093 7875 5906 4574 9893 2002 2242 1976 7649 6808 8583 9250 4236 4733 8767 2428 4573 9070 7278 1441 656 1325 9908 690 6645 4472 4135 5803 3631 4120 2512 1368 5353 7445 2533 954 8162 5870 5988 9570 8280 3274 215...
output:
95 4954 1 3915 3675 4662 9903 791 4440 7950 9883 5847 421 4710 2788 3997 9417 6573 1003 4849 5400 8532 4618 5300 6756 3554 501 7813 4982 118 9655 9873 283 1781 4096 9269 3511 9885 5248 3433 3851 5366 2907 8316 8782 5722 8227 5732 9538 2810 9053 2517 8160 8390 4108 6300 9595 4347 5106 4829 8804 5855 ...
result:
ok
Test #35:
score: 0
Accepted
time: 14ms
memory: 17136kb
input:
10000 63482 9956 6120 8634 1549 933 8173 5984 8157 1540 6235 6771 4790 9190 1205 2900 8761 6223 7171 7131 6777 9220 8923 7229 9749 723 8485 3449 6521 9201 2455 1680 8590 6124 4632 8690 4603 7840 9199 3290 663 6613 9240 4743 2753 1301 755 9143 9056 4533 754 2930 8516 4333 9255 4558 5841 9612 6436 981...
output:
70 4965 1 3724 1747 1633 8017 1651 6168 9221 8644 5825 9475 7455 1055 6035 345 1047 1858 9202 2972 5221 5376 7595 1407 1288 6822 4852 7190 2135 6076 2492 4434 7407 3549 8019 9703 3442 1185 170 2078 5394 6608 1508 357 8834 115 3066 2608 102 3070 6195 1560 2128 6126 2835 1789 1026 5028 7978 807 101 25...
result:
ok
Test #36:
score: 0
Accepted
time: 30ms
memory: 19972kb
input:
10001 200000 7990 8651 9078 312 4894 1058 4121 2912 5524 6771 866 9344 7969 5279 5441 6964 2348 1113 5446 3185 9933 9702 4809 3753 3664 8028 9983 7200 9224 373 42 9423 873 3835 8057 8877 6644 2959 3592 3271 306 8157 7804 2381 1102 424 1923 8652 5067 9232 6679 9850 1190 2261 787 4914 1609 5097 3589 4...
output:
415 4793 1 6531 3477 9176 370 8969 6952 3031 4218 1209 9669 5862 5628 2248 3340 8966 7355 5958 1432 5724 3285 4704 8431 1296 3729 7419 6290 7200 9983 3294 5178 2114 7064 736 935 5255 7592 2241 9067 330 9562 9554 8931 252 4111 1138 4130 767 537 6751 8126 8250 626 2492 7359 7944 2230 3991 1039 3377 44...
result:
ok