QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#58020 | #4835. Mode | MIT01# | AC ✓ | 1873ms | 19084kb | C++ | 3.9kb | 2022-10-24 10:43:35 | 2022-10-24 10:43:36 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define mod 998244353
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll ksm(ll a, ll b) {if (b == 0) return 1; ll ns = ksm(a, b >> 1); ns = ns * ns % mod; if (b & 1) ns = ns * a % mod; return ns;}
using namespace std;
const int maxn = 200005;
const int D = 455;
int n;
int a[maxn];
vi pl[maxn];
int ind[maxn]; // index
int ext[D]; //
int sum[maxn];
int ans[maxn];
void upd(int a, int b) {
chkmax(ans[a], b);
}
int main() {
int t;
cin >> t;
while (t--) {
cin >> n;
for (int j = 1; j <= n; j++) ans[j] = 0;
const int S = D - 5;
vi tr;
for (int i = 1; i <= n; i++) scanf("%d", &a[i]), tr.pb(a[i]);
sort(tr.begin(), tr.end());
for (int i = 1; i <= n; i++)
a[i] = lower_bound(tr.begin(), tr.end(), a[i]) - tr.begin() + 1;
for (int i = 1; i <= n; i++) pl[i].clear();
for (int i = 1; i <= n; i++)
pl[a[i]].pb(i);
for (int i = 1; i <= n; i++)
for (int j = 0; j < pl[i].size(); j++)
ind[pl[i][j]] = j;
// small small
for (int j = 0; j < D; j++)
ext[j] = n + 1;
auto big = [&](int tp) {
if (pl[tp].size() >= S)
return 1;
return 0;
};
auto calans = [&](int tp) {
// should never call this with big ones!
if (big(tp)) return 0;
int res = 0;
int id = 0;
for (int j = 0; j < D; j++) {
int ed = ext[j];
if (ed > n)
break;
while (id < pl[tp].size() && pl[tp][id] <= ed)
id++;
int nans = pl[tp].size() - id + j;
chkmax(res, nans);
}
return res;
};
for (int i = n; i >= 1; i--) {
int nans = calans(a[i]) + ind[i] + 1;
upd(a[i], nans);
for (int j = ind[i]; j < pl[a[i]].size() && j < ind[i] + S; j++)
chkmin(ext[j - ind[i] + 1], pl[a[i]][j]);
for (int j = 0; j < D - 1; j++)
chkmin(ext[j], ext[j + 1]);
}
for (int i = 1; i <= n; i++)
upd(i, calans(i));
// now do big
for (int i = 1; i <= n; i++) {
if (!big(i)) continue;
for (int j = 1; j <= n; j++)
sum[j] = (sum[j - 1] + (a[j] == i));
for (int b = 1; b <= n; b++) {
if (b == i) continue;
int mpref = 0;
int mans = 0;
for (int j = 0; j < pl[b].size(); j++) {
int id = pl[b][j];
chkmin(mpref, -sum[id] + j);
chkmax(mans, -sum[id] + j + 1 - mpref);
}
upd(i, mans + pl[i].size());
}
// b outside
for (int b = 1; b <= n; b++) {
if (b == i) continue;
int mpref = 0;
int mans = 0;
for (int j = 0; j < pl[b].size(); j++) {
int id = pl[b][j];
chkmax(mans, sum[id] - j - mpref);
chkmin(mpref, sum[id] - j - 1);
}
upd(b, mans + pl[b].size());
}
}
int maxans = 0;
for (int i = 1; i <= n; i++)
chkmax(maxans, ans[i]);
cout << maxans << endl;
for (int i = 1; i <= n; i++)
if (ans[i] == maxans)
printf("%d\n", tr[i - 1]);
}
return 0;
}
/*
4
5
1 2 3 2 1
5
1 1 3 1 1
6 2 4 2 4 8 8 5
1 2 3 4 5
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 9324kb
input:
4 5 1 2 3 2 1 5 1 1 3 1 1 6 2 4 2 4 8 8 5 1 2 3 4 5
output:
4 1 5 1 4 2 4 8 2 1 2 3 4 5
result:
ok 14 numbers
Test #2:
score: 0
Accepted
time: 3ms
memory: 10424kb
input:
10 300 336470888 634074578 642802746 167959139 642802746 481199252 481199252 481199252 167959139 634074578 634074578 336470888 336470888 481199252 642802746 481199252 481199252 167959139 642802746 634074578 167959139 336470888 634074578 642802746 167959139 481199252 167959139 167959139 167959139 481...
output:
80 481199252 634074578 46 153774342 39 846318354 30 937534594 27 698063951 27 419330425 20 603780410 706588687 801036056 20 541308492 19 352404708 16 187061768 428773075
result:
ok 24 numbers
Test #3:
score: 0
Accepted
time: 4ms
memory: 10140kb
input:
10 300 641009859 804928248 804928248 804928248 804928248 641009859 476927808 641009859 641009859 641009859 75475634 804928248 804928248 641009859 804928248 54748096 75475634 75475634 54748096 75475634 54748096 54748096 476927808 476927808 75475634 476927808 641009859 75475634 476927808 476927808 754...
output:
84 75475634 47 173884819 253838924 593535580 37 119584259 29 66715052 671541499 706982083 25 683509776 23 145885283 637691905 26 968506132 18 277852473 891198181 954696748 18 967045702 19 493331319
result:
ok 27 numbers
Test #4:
score: 0
Accepted
time: 5ms
memory: 9504kb
input:
10 300 923264237 524125987 524125987 524125987 923264237 751244358 374288891 923264237 923264237 923264237 535590429 524125987 374288891 751244358 524125987 923264237 751244358 751244358 923264237 751244358 535590429 535590429 751244358 923264237 751244358 524125987 751244358 923264237 524125987 923...
output:
85 524125987 50 475906689 38 802613215 28 824887911 28 506836893 754648411 23 708438632 731263599 20 210467639 284624362 746100908 806519500 980100704 21 797383894 21 156438550 977566828 17 111777754
result:
ok 27 numbers
Test #5:
score: 0
Accepted
time: 2ms
memory: 9260kb
input:
10 300 702209411 496813081 561219907 702209411 702209411 561219907 730593611 496813081 702209411 561219907 673102149 702209411 496813081 702209411 673102149 496813081 730593611 496813081 673102149 702209411 673102149 673102149 496813081 496813081 702209411 673102149 561219907 702209411 561219907 561...
output:
81 496813081 53 675266630 38 767363622 32 404396525 27 118275344 195136790 21 422498140 522949042 869477976 887728896 998214353 22 611458649 20 298642883 618165181 853396846 18 510545542 18 41119063 42804963 383659701
result:
ok 29 numbers
Test #6:
score: 0
Accepted
time: 616ms
memory: 14428kb
input:
6 200000 564718673 564718673 291882089 291882089 412106895 291882089 291882089 412106895 564718673 564718673 412106895 412106895 412106895 564718673 291882089 564718673 412106895 291882089 564718673 291882089 564718673 291882089 291882089 564718673 291882089 412106895 564718673 291882089 564718673 5...
output:
72021 564718673 40464 764450551 14267 485362070 14627 904735088 4168 647351267 2097 876938652
result:
ok 12 numbers
Test #7:
score: 0
Accepted
time: 605ms
memory: 14720kb
input:
6 200000 757703054 544067926 5887448 544067926 757703054 757703054 544067926 757703054 544067926 544067926 643910770 544067926 5887448 544067926 757703054 544067926 5887448 544067926 5887448 643910770 5887448 757703054 544067926 544067926 544067926 544067926 544067926 544067926 757703054 757703054 5...
output:
72009 544067926 40553 532894160 14507 280401558 14661 652613244 4149 954112179 2118 387281831
result:
ok 12 numbers
Test #8:
score: 0
Accepted
time: 624ms
memory: 14552kb
input:
6 200000 941492387 378192988 783332532 378192988 378192988 72235422 378192988 378192988 378192988 783332532 783332532 783332532 378192988 378192988 783332532 378192988 783332532 72235422 378192988 449924898 378192988 783332532 941492387 449924898 72235422 72235422 72235422 378192988 378192988 378192...
output:
72125 378192988 40566 204258647 14420 679764421 14458 621315231 4176 283127255 2125 379004468
result:
ok 12 numbers
Test #9:
score: 0
Accepted
time: 634ms
memory: 14284kb
input:
6 200000 652509537 513994713 513994713 513994713 940751563 652509537 652509537 43705451 513994713 652509537 43705451 513994713 513994713 652509537 652509537 43705451 513994713 940751563 513994713 652509537 43705451 940751563 43705451 43705451 652509537 513994713 513994713 652509537 513994713 5139947...
output:
72040 652509537 40565 33034714 14364 848061415 14689 972643361 4192 106061785 2110 861238489
result:
ok 12 numbers
Test #10:
score: 0
Accepted
time: 264ms
memory: 12612kb
input:
9 50000 264178469 144383292 725622388 29492121 605488152 580675905 55883389 390555088 441004197 831609975 438791943 987615719 859267729 743196568 55883389 39388076 959436397 876153780 45621610 363531956 977960026 782710197 106874917 807199457 562810007 715666999 743196568 538628510 824046493 1893675...
output:
432 752268030 91 254698774 3 12093 60583 90748 127514 236374 353911 368891 378263 400779 470972 478812 494946 510827 581713 599252 615790 629984 637246 701304 786939 829043 829312 845188 889918 916550 959344 965105 1017725 1049787 1062654 1070749 1080286 1081671 1166002 1169723 1181573 1183208 12207...
result:
ok 25213 numbers
Test #11:
score: 0
Accepted
time: 277ms
memory: 10948kb
input:
9 50000 962118480 224422012 530689910 598196518 780267148 621837875 609026662 572394174 7897785 147043779 266397628 168565069 996408310 102067050 634382639 349570916 116002772 879226371 885888570 327981393 627552028 237784764 96204862 620985129 565390129 447700005 116002772 631413076 653535984 20424...
output:
416 62611196 983359971 90 107074781 643264242 3 23227 45992 77973 82516 88807 165433 168782 196483 329750 379946 434404 476061 484239 514555 515876 595779 609792 610877 636970 751634 779432 789743 857129 895585 912839 1076739 1166389 1258455 1310282 1337130 1420860 1499159 1570380 1579613 1592225 17...
result:
ok 25218 numbers
Test #12:
score: 0
Accepted
time: 674ms
memory: 15652kb
input:
9 200000 135784616 930376306 84361809 985295444 851292970 269236805 856798091 271181548 762217893 856798091 462749196 120755595 531571129 604211010 493908907 940486169 604211010 283516964 762217893 407741671 990711947 205335962 178685515 360234468 964851431 992963178 261895625 812267178 990711947 17...
output:
1519 6962495 106 284854399 36 72700176 625030539 998418613 20 4708984 21638247 25944554 311172186 357325474 670434401 773565295 1015 406948177 2501 99440824 107215326 375570744 387799976 55 11588682 12972610 20897063 26205844 37106836 45190049 55821994 58636324 79987571 82666901 90477975 91080230 95...
result:
ok 45168 numbers
Test #13:
score: 0
Accepted
time: 676ms
memory: 15736kb
input:
9 200000 725743030 30028136 108363704 132541583 233129596 19219689 856407544 987503539 172639782 153113856 729626528 341033928 156410721 482750975 678092074 494457330 258978219 146102138 709650431 274969460 59820892 664720419 990219478 322188987 901999530 675880331 943159603 423585569 272812766 1743...
output:
1538 343342034 106 317511752 539940990 725124952 35 768762226 20 6523560 60432456 114843736 126398351 156670961 283509084 371703512 426837279 436686342 468890936 473003550 504146483 554659729 835413643 1019 987463849 5001 396357249 404217765 56 10939303 11521641 13992263 17225651 24816521 28990577 3...
result:
ok 45201 numbers
Test #14:
score: 0
Accepted
time: 661ms
memory: 15748kb
input:
9 200000 259924440 482843646 698405858 81829609 668643035 120115078 465713378 795525066 468586155 869487013 464799976 872257813 729091232 158103417 939650978 204652647 729091232 948940622 284430414 575073865 259924440 668643035 668643035 81829609 450236911 129772276 812967691 305614847 729091232 877...
output:
1513 22499636 109 723253814 34 235430243 20 6390485 16439594 84871695 90637215 105894856 111732401 114485810 115322402 135713539 172295642 198914375 307517989 319720950 330982551 424398819 485917637 494352242 542747394 580755161 606211322 646568947 724021598 736789363 766748367 776946075 792336125 8...
result:
ok 45117 numbers
Test #15:
score: 0
Accepted
time: 689ms
memory: 15744kb
input:
9 200000 888134619 66269133 509900976 163810765 143703759 163810765 854756227 146141988 888134619 183817154 978602533 5192585 715910077 5192585 567678137 774920273 470853832 368687845 368799527 203971504 240701357 644793984 183817154 774920273 653069289 180071384 978602533 408839201 183817154 171420...
output:
1511 448599941 107 926889556 35 184205986 306398259 526309676 747903041 20 42810625 100223221 107274411 111942280 124998844 131893527 149445814 154380679 169672593 177752769 186703689 238905954 285690681 360707994 381030191 388106329 389961350 485320672 533728043 537938022 557774659 583518077 593019...
result:
ok 45236 numbers
Test #16:
score: 0
Accepted
time: 679ms
memory: 15656kb
input:
9 200000 73842336 136680216 621080695 666865318 160471107 546318047 6426671 382252749 368317095 556784178 162093547 261854484 843033743 258790234 484537901 158560673 908579552 102513046 765800986 190705915 355958959 660867016 560507758 73842336 459238545 919716424 739715261 99349978 946879386 592356...
output:
1513 182330345 115 924866239 35 473421507 544286978 20 27578725 69995657 96254998 108343444 130958890 148622143 161397629 188299191 256845517 288071428 322808295 341013782 348676074 405252151 417261444 423000440 509097231 522038777 571201755 579809652 593380535 600545884 648569241 691095316 70265638...
result:
ok 45125 numbers
Test #17:
score: 0
Accepted
time: 705ms
memory: 15732kb
input:
9 200000 317786155 96515847 222493722 70967262 888446782 779886867 638247548 338875831 172030458 78054611 767171259 127409208 837418741 736004147 458027028 580568152 462603834 875136891 686756569 436879176 857115203 886678205 172030458 819971755 530735129 747661596 363495802 654860294 279397774 1274...
output:
1497 548228514 110 244545335 32 19180303 48171730 66461630 320868401 410993082 573856318 639377421 719064833 784665837 936236452 20 10204603 32434499 60092661 64234622 164436517 224151388 261203787 303689062 323180625 348100475 371038641 391283497 408543592 452957601 465602602 485938740 488269740 57...
result:
ok 45140 numbers
Test #18:
score: 0
Accepted
time: 678ms
memory: 15756kb
input:
9 200000 45409652 235649445 235649445 549349991 458256339 790761728 328822538 625672915 164800546 599197383 72261464 754382508 216022244 777618263 381586476 29613623 678393925 224602191 207229582 11988400 25203298 233596921 815509812 305555972 48953130 707869688 216022244 64999512 862759972 78793927...
output:
1508 843116152 106 118864836 35 380920549 20 10282409 42159790 63145970 70091816 152051075 177868106 190621579 355548478 361587442 435572107 436289783 445885116 467186436 473242102 503654443 520957056 542819238 578606653 593074719 599679913 627545388 695163335 702826276 745014921 759849791 777728998...
result:
ok 45186 numbers
Test #19:
score: 0
Accepted
time: 678ms
memory: 15604kb
input:
9 200000 962636738 659949746 990724893 374392733 418160283 432681473 280790303 990724893 479162773 255124409 525244419 449144296 869729807 401182818 599473018 60606166 663226971 418160283 235756777 286461965 249699420 179944793 60606166 642879999 371616484 173351006 753434266 107173713 718880383 249...
output:
1502 453595703 105 278346314 386832331 37 365936735 382124501 20 24669726 105664496 356210646 531168236 603403566 644042701 686072325 790180830 955137028 996520483 1017 248599916 3335 298072584 67 19993925 20652289 33823722 86416159 86935428 95705174 96591200 106100027 145327727 149208966 167933457 ...
result:
ok 45135 numbers
Test #20:
score: 0
Accepted
time: 674ms
memory: 15660kb
input:
9 200000 115209394 576447346 547139308 261969202 914539062 20101580 356150426 467908848 232758068 818725993 467908848 159595153 590951729 282436814 758315712 193787527 408916833 738307717 479489724 764655030 338589400 454338516 818725993 483456905 276843270 363467715 965696474 239862203 590951729 36...
output:
1495 214911410 102 462891101 38 57040259 20 5378814 173349077 230192561 336434984 399643086 426558780 440657144 559123439 585280058 585877393 603956467 626298919 685558179 741260520 831109430 905506922 1017 755021310 2501 129390957 297826679 435587260 460940731 63 10654436 21766107 40937212 42479069...
result:
ok 45144 numbers
Test #21:
score: 0
Accepted
time: 662ms
memory: 15724kb
input:
9 200000 199661234 217496893 475351765 102844764 801878032 280362149 382292455 862407789 919571086 237784464 396909705 717802881 798684788 51795969 586588704 694385934 427833657 422130608 661699500 903631686 610613187 730980950 382292455 234429745 81507010 811254995 935958538 148658854 694385934 724...
output:
1517 668774730 112 790429610 35 599135129 20 5099691 13151910 26320111 43761826 53238162 53859450 61867865 81043710 99510236 116965675 119782176 124281900 124750791 170506037 205834874 231072926 285760927 294631038 301802212 373554157 384765556 386390796 391457725 447883817 461393830 463501811 48391...
result:
ok 45135 numbers
Test #22:
score: 0
Accepted
time: 1814ms
memory: 14480kb
input:
12 200000 621837875 912591234 690846426 701317769 546816240 116002772 466097892 466097892 25203351 303640854 102467451 463278943 998133227 642911606 5764908 420188705 500165093 521027619 870739178 164353437 831452391 472379315 121227049 885888570 343766215 455613697 192568336 598196518 267884026 559...
output:
567 555021253 553 999556574 146 464481495 506807243 996793562 146 260946585 149 163152318 145 10589735 151 464276585 910383052 153 247651600 153 209289768 143 312865595 149 281040524 163 308903629
result:
ok 27 numbers
Test #23:
score: 0
Accepted
time: 1826ms
memory: 14456kb
input:
12 200000 370603489 664428413 691221020 404550937 397553759 212099144 1183950 394723686 965842615 186541210 366609304 922325388 986843824 607462718 337347676 142309830 556784178 459697693 959563567 594698736 220554376 504358725 671621196 190705915 961764255 179312193 700870788 906247500 812641396 25...
output:
560 160471107 556 269683414 147 969493461 149 953182231 151 989695857 160 498389163 146 375562325 823788952 935194886 142 529558126 158 517611126 145 9522523 151 441868349 147 507118209 735024584
result:
ok 27 numbers
Test #24:
score: 0
Accepted
time: 1873ms
memory: 14376kb
input:
12 200000 263108134 410798836 954188127 288981803 987402045 284628200 777325374 954188127 105222291 680203324 291882089 843867422 772384081 342221155 141752547 168640248 832493514 825909652 27589620 239494556 116162344 272975891 956047973 124220868 570815250 753287868 182345928 783004249 460325662 1...
output:
561 415766154 571 902696644 147 692733732 150 3088356 145 609346651 143 424017125 144 269193777 156 250757955 147 401968727 746209387 153 176955662 143 916184024 149 993559822
result:
ok 25 numbers
Test #25:
score: 0
Accepted
time: 224ms
memory: 19084kb
input:
3 200000 768070489 155646510 300222152 304313790 394030369 248760595 213928971 424543469 526157364 268491550 145165784 698582889 688484496 349667237 793586464 173350515 624538053 835180131 931297606 263074510 289730398 48996865 222976981 437128689 698533623 705010454 730665089 241461147 737200279 54...
output:
10 176477369 10 393685379 505935648 982669127 8 258969950
result:
ok 8 numbers
Test #26:
score: 0
Accepted
time: 251ms
memory: 16996kb
input:
3 200000 548392630 974674906 687038678 720699810 249052516 1843732 978586994 450089092 100213111 968651658 69130250 6350530 470762974 924157835 83187512 685486146 50668241 163108137 430677841 974341714 226627270 617059334 572463556 878701340 932096423 601879459 944737648 743586316 382628235 27542126...
output:
18 63865282 67209431 697584428 17 104953088 172526757 375829226 487660122 911428360 14 371637312 580448494
result:
ok 13 numbers
Test #27:
score: 0
Accepted
time: 324ms
memory: 15284kb
input:
3 200000 947515860 537968727 261308895 436373577 220203016 755212333 551935282 663434334 544448529 99802614 461870120 750193071 515384217 192772436 375797389 189941996 343232011 823404747 560632061 367679666 817871090 137258084 71902916 13497792 735494742 870943688 556347834 448986475 594518494 4260...
output:
55 958295208 53 681406334 37 424351822
result:
ok 6 numbers
Test #28:
score: 0
Accepted
time: 370ms
memory: 14460kb
input:
3 200000 602393101 171463264 823283321 105499743 501602707 223716628 47569478 391848325 619411117 785336636 407390141 767006283 896190429 462505745 90803226 728653849 792437640 465691977 785108626 69736839 471194135 79911922 241085287 867961430 541680726 699088728 987839363 981987455 940251674 28053...
output:
81 842645468 83 514555899 748856612 50 237512619 813210256
result:
ok 8 numbers
Test #29:
score: 0
Accepted
time: 595ms
memory: 14000kb
input:
3 200000 397255490 90335256 477760767 56582319 182905910 476408691 108276441 538025264 706455387 950701291 277466189 738513678 236628977 478527202 391596733 788666283 381957415 57564490 635810211 919404375 730492847 502194925 8404368 923141319 318848649 385633420 824126231 617426000 961291679 404803...
output:
165 191837368 164 435560644 97 75567459
result:
ok 6 numbers
Test #30:
score: 0
Accepted
time: 713ms
memory: 15448kb
input:
3 200000 669874625 678859295 889658269 916298811 383995766 621423825 911627349 916776543 138384113 549165027 45670078 195595951 297836448 138384113 922794845 314160860 314528311 794716218 95633919 851782428 980998805 732983857 33878278 545925883 272160644 407498113 51404709 657954354 383665690 91044...
output:
202 984963674 208 951260658 116 41316651
result:
ok 6 numbers
Test #31:
score: 0
Accepted
time: 948ms
memory: 13984kb
input:
3 200000 220273039 19951732 253391982 277100719 195213880 57312560 866195953 2016338 837928371 991986022 767455898 729289682 357750527 249663396 251035618 468925871 9813023 534200288 159252242 121000761 835180568 824487513 868324576 203323461 474617059 304308281 871505596 444152299 542170240 2988246...
output:
282 109147879 275 996838593 158 354294691 542189233 652967622 653079452 687244441
result:
ok 10 numbers
Test #32:
score: 0
Accepted
time: 1113ms
memory: 14900kb
input:
3 200000 409535090 117857201 935577830 593092100 622494855 312431575 211382521 455955390 704837361 823614796 846812765 526081690 801380164 457805638 898744353 976192110 783286874 124958803 448660895 183100469 449701943 460021975 334440680 15918576 788171795 163740227 276813126 213315965 787189340 19...
output:
343 298746830 337 807616755 189 807071879
result:
ok 6 numbers
Test #33:
score: 0
Accepted
time: 1633ms
memory: 14724kb
input:
3 200000 839434251 547629264 97995429 533039140 902079972 816953479 101405180 714259588 453676646 809160713 331553509 494745649 827758961 381842503 714259588 403311180 293596797 425604363 60078265 634887213 989616129 459259771 83887625 851812474 726182086 781752747 149520909 649628707 289061887 8112...
output:
510 616562494 512 420327404 282 205264396
result:
ok 6 numbers
Test #34:
score: 0
Accepted
time: 1370ms
memory: 14776kb
input:
3 200000 483499915 593762592 224616388 768801762 651375573 541445552 223728335 947765877 839292000 975678275 712614637 53008529 953425815 433378013 947765877 950842442 789033059 553477685 28883799 438601900 101228973 526821031 845209987 313441109 236976788 953425815 471006086 471006086 556590178 541...
output:
1151 426239073 1151 86194435 611 82808828
result:
ok 6 numbers
Test #35:
score: 0
Accepted
time: 991ms
memory: 14524kb
input:
3 200000 756817592 541498332 542816550 695577097 878307836 964851095 16105849 504097203 7588783 24267327 693521941 615698608 594008733 710666324 674773157 112500912 72014851 756817592 283385445 541498332 497801211 122650612 497801211 511891388 878307836 990051085 850699824 842132762 695577097 541498...
output:
2252 105991457 2242 529588387 1140 755664920
result:
ok 6 numbers
Test #36:
score: 0
Accepted
time: 791ms
memory: 14004kb
input:
3 200000 493209391 850742532 493209391 85102688 346947701 953493193 303441516 303441516 910108604 912653754 313149241 953493193 137282325 567819709 416298988 682083520 86208858 750252685 86208858 85102688 911878476 770048418 910108604 950335557 399456789 853089428 677451896 303441516 750252685 44104...
output:
4291 183160045 4262 90791701 2195 923114227
result:
ok 6 numbers
Test #37:
score: 0
Accepted
time: 690ms
memory: 14792kb
input:
3 200000 782470456 70128557 230528928 326709580 387892542 782470456 20397056 387892542 70128557 230528928 270819075 714260443 752254363 752254363 528945347 782470456 610007037 714260443 326709580 20397056 782470456 20397056 778867809 326709580 249365844 270819075 249365844 782470456 270819075 778867...
output:
10306 782470456 10357 216192812 5300 406132233
result:
ok 6 numbers
Test #38:
score: 0
Accepted
time: 652ms
memory: 14564kb
input:
3 200000 729851566 960408645 676334657 67234301 729851566 676334657 960408645 67234301 421680081 451284888 676334657 676334657 351852473 40471253 67234301 67234301 40471253 676334657 421680081 676334657 205047695 960408645 451284888 67234301 40471253 207592314 351852473 421680081 676334657 676334657...
output:
20464 351852473 20371 180769235 10349 133066999
result:
ok 6 numbers
Test #39:
score: 0
Accepted
time: 628ms
memory: 13940kb
input:
3 200000 209352850 321923464 209352850 321923464 321923464 209352850 209352850 209352850 209352850 321923464 209352850 321923464 321923464 209352850 321923464 209352850 209352850 321923464 209352850 321923464 321923464 321923464 209352850 209352850 321923464 209352850 321923464 321923464 321923464 3...
output:
100324 321923464 100308 503161767 765794138 50332 268854719
result:
ok 7 numbers
Test #40:
score: 0
Accepted
time: 247ms
memory: 15944kb
input:
3 200000 289551814 184638719 845604940 379133004 894426169 204702585 369600034 261842211 589176896 145694671 224679749 257442084 996781757 395207002 693047306 78889344 229098725 496360135 792365142 502432187 942815 558922500 31437177 366723065 800580489 505069787 823595215 460625066 122092135 590608...
output:
4 2275 4238 10402 15364 20742 22651 27045 29101 41533 75249 77973 79317 103133 108880 132900 133300 136844 150153 200336 209476 244518 258335 264730 277788 280632 282238 293993 297253 303615 314900 317842 327945 329428 333321 343986 350330 358849 363617 388842 391589 393175 419778 423396 449210 4731...
result:
ok 300003 numbers
Test #41:
score: 0
Accepted
time: 263ms
memory: 13804kb
input:
3 200000 572313878 949425940 377406214 850990790 237327578 981603199 609005936 770776378 705195459 353586902 880305645 821061903 580341337 2491299 884579450 571956774 622963132 116009800 434413396 425035176 721086063 794247594 149306871 591029439 545069918 164245774 135490763 697267078 163320943 324...
output:
38 56439118 84170263 125899862 205246426 512950876 550940334 818961934 909908011 926474682 39 29081986 29597591 132217109 162609220 311456787 327456438 421207360 539814675 579971671 611919254 697167026 790890788 813699390 988388625 20 381202 985878 1114350 1331742 2462903 4859778 7541110 10918299 12...
result:
ok 814 numbers
Test #42:
score: 0
Accepted
time: 327ms
memory: 14528kb
input:
3 200000 597721884 453519132 477846003 11431095 454186713 667470388 736069479 532972570 667470388 818132190 57448878 757826563 176711671 470702575 263634157 954043641 344449427 206326422 880603607 354049054 42606351 210191007 89342205 340161099 395701255 140875645 761091408 536037499 412521241 90383...
output:
69 192110830 67 822012535 39 481081334 757317045 956734633
result:
ok 8 numbers
Test #43:
score: 0
Accepted
time: 536ms
memory: 13728kb
input:
3 200000 294235838 116479305 409827371 606399388 951004483 487444816 14388968 903660046 139640694 366221597 319848576 105849550 857433550 765413757 876863104 236661374 187126972 848640046 674363047 590523212 293101038 961320432 94100867 717149427 397252490 460280199 800335112 378310805 166007629 267...
output:
141 537119542 142 613073120 749576830 837086363 890251833 78 802337419
result:
ok 9 numbers
Test #44:
score: 0
Accepted
time: 636ms
memory: 13964kb
input:
3 199500 742034719 869104127 518833346 834823711 160744560 32842924 322952180 397069313 371667398 892106674 472472007 445377921 883941127 29587307 246570805 165964446 898562456 52500783 304067117 458130094 600472543 802056139 30153616 559073932 762731387 332833668 571640237 216888731 820130133 39424...
output:
181 255900574 180 600578076 100 631335127
result:
ok 6 numbers
Test #45:
score: 0
Accepted
time: 873ms
memory: 13404kb
input:
3 200000 884746094 982624379 19045637 889895183 783532428 477640893 173985115 283013672 861418447 636876471 157194374 146041597 493979952 681859053 145165671 259452523 426683063 779141320 968191203 533797780 631353157 622444924 277138911 211870737 139811521 695636388 681565672 162205635 687525149 88...
output:
262 70560999 257 664204416 138 548981468 552626973 845114852
result:
ok 8 numbers
Test #46:
score: 0
Accepted
time: 1028ms
memory: 13980kb
input:
3 200000 556636290 35106085 354516707 354516707 749656719 322168283 78812129 7129247 256231562 111827131 221925270 577987465 216958259 83686388 424249145 338066222 912935291 482658512 418185859 133405005 691164592 934706980 742313610 651553721 747669676 560418843 234617786 780808331 140056679 578128...
output:
313 223624169 313 261974337 169 322871560
result:
ok 6 numbers
Test #47:
score: 0
Accepted
time: 1518ms
memory: 13404kb
input:
3 200000 834343396 172310825 782781711 816624552 744787543 327282225 739228681 825839989 857262932 726887623 318918369 581630898 601354362 569990914 473498696 444330780 539743852 736407180 692448627 748347641 334665617 120517784 462524840 252090332 816282402 50900884 404865456 297788272 710199710 17...
output:
475 642744475 484 538699266 256 723102178
result:
ok 6 numbers
Test #48:
score: 0
Accepted
time: 1369ms
memory: 13920kb
input:
3 200000 837085714 103960047 598971480 626855083 155027969 128534880 78174165 616858967 966359149 428211933 196870147 174943981 159142969 754470481 157746565 915983911 471187172 797722049 871461206 886992570 138185061 805200214 586125511 605550781 860772899 862847800 54134781 967812617 770877578 474...
output:
1111 633392816 1112 883807267 581 675400727
result:
ok 6 numbers
Test #49:
score: 0
Accepted
time: 977ms
memory: 13840kb
input:
3 200000 220171253 980235621 743601516 517470573 842905677 363201642 735682951 168051888 697219668 144711345 815836801 213288775 638767361 363201642 653167218 655317356 928475930 735639638 178938938 122927322 697219668 409916766 983563475 504647896 512888029 428531062 662492655 752857051 205053988 8...
output:
2165 980235621 2155 926773882 1092 25582314 725190007
result:
ok 7 numbers
Test #50:
score: 0
Accepted
time: 781ms
memory: 13864kb
input:
3 200000 842544225 875524323 968221439 896817959 842544225 738246203 154662449 842544225 311158457 674523362 59333040 968221439 59717503 32346708 826569662 19604567 29582195 59717503 842544225 298552927 842544225 59333040 785594454 367101605 49874645 154662449 885883231 563390705 731637001 115971073...
output:
4206 262446566 4222 137828717 2139 803125363
result:
ok 6 numbers
Test #51:
score: 0
Accepted
time: 679ms
memory: 14192kb
input:
3 200000 569159574 67449202 934400657 334168650 320831308 61427739 940490240 107650938 854577773 24856345 750915670 496673051 284267477 334168650 149452285 261584334 149452285 940490240 61427739 854577773 261584334 496673051 398926946 67449202 750915670 334168650 35502086 293132932 291232645 1494522...
output:
10289 61427739 10246 649326591 5221 555736557
result:
ok 6 numbers
Test #52:
score: 0
Accepted
time: 651ms
memory: 14288kb
input:
3 200000 634669084 241803838 241803838 241803838 289652563 425981850 289652563 733589070 634669084 425981850 701073936 241803838 289652563 241803838 289652563 499127998 634669084 634669084 701073936 869754125 634669084 425981850 73035554 869754125 241803838 869754125 733589070 634669084 869754125 49...
output:
20366 733589070 20337 393390990 10227 973286039
result:
ok 6 numbers
Test #53:
score: 0
Accepted
time: 625ms
memory: 13856kb
input:
3 200000 261806843 261806843 588822530 588822530 588822530 588822530 261806843 261806843 261806843 588822530 261806843 588822530 261806843 588822530 261806843 588822530 261806843 261806843 261806843 588822530 588822530 261806843 261806843 261806843 261806843 588822530 261806843 588822530 588822530 2...
output:
100566 261806843 100633 207587633 50548 394784533
result:
ok 6 numbers
Test #54:
score: 0
Accepted
time: 241ms
memory: 16040kb
input:
3 200000 65145095 77047016 470812448 243985013 771329181 394427575 417020377 876038618 444180094 283250340 58775656 299153788 341070698 458234420 263758965 467552257 643423530 571635983 128612901 469536912 106329382 44359415 610583241 538490987 714328987 515391666 592643464 486062714 790432712 10964...
output:
4 51 2967 11953 21611 33969 35901 45001 46240 50058 81969 82328 86740 87082 92307 94843 102670 103994 129284 144732 147808 148003 153191 153613 154206 160272 183346 194938 197055 207092 208656 215588 247901 253376 253468 255641 257197 258978 272920 280240 297581 300173 302856 319231 331643 355966 36...
result:
ok 299977 numbers
Test #55:
score: 0
Accepted
time: 219ms
memory: 14548kb
input:
3 200000 859498911 275924741 935765111 801553392 462725312 215186210 189927145 421300653 511074643 954348822 310518032 459936425 963724460 705714714 804968275 651939510 524786254 949402165 874257676 4819589 355561597 893928749 569418670 158249067 442899524 282960547 705677176 817116424 631412210 119...
output:
22 204129 241091 261504 597371 716095 811407 863633 901590 912310 1062638 1246270 1321501 1400098 1537605 1697804 1729504 1742718 1759785 1762332 1861193 1927419 1953367 2115630 2325016 2453465 2550975 2572716 2591215 2676878 2840057 2938035 2939934 2946454 3196352 3242873 3253416 3406155 3544884 35...
result:
ok 30003 numbers
Test #56:
score: 0
Accepted
time: 347ms
memory: 14060kb
input:
3 200000 221130081 823537998 885935735 312734661 318089943 127042745 591267956 117532407 868258499 269669128 116547122 474433755 353960155 508072075 394617082 841512245 848427154 90586522 193130055 463992600 688115947 201003527 934955899 637763467 544401264 730331333 684540025 76077660 28819106 7695...
output:
102 1309779 2703455 3363890 4414605 4846209 5364546 6202955 6506108 7323180 7372101 7978783 8731374 10012672 10539184 10653357 10836318 10923857 11360488 12023447 12303714 12315791 13598345 13663174 13740410 15307552 15491889 15884083 16023311 16732672 17729626 18214693 19028680 20709811 20778218 21...
result:
ok 6003 numbers
Test #57:
score: 0
Accepted
time: 409ms
memory: 13920kb
input:
3 199500 360325052 935402895 21854534 411049183 515643766 564454047 77800839 3156529 646202569 471413976 672322926 618757956 101866024 520071146 432091658 838602837 938449687 229731142 867356054 772134382 65948673 148108228 498160811 283911712 579805211 646386664 602982404 630985048 994786660 528681...
output:
135 2786113 3156529 5370655 5901047 6259852 7234937 7558478 7715116 8183510 8731990 9108119 10038290 10568256 11879034 12797150 17045472 17256995 17867045 18465643 18721594 19329799 20084703 20673555 21854534 22143344 23761262 24234143 24245779 24815452 25324117 25814547 26528828 26721053 27846700 2...
result:
ok 4503 numbers
Test #58:
score: 0
Accepted
time: 487ms
memory: 13460kb
input:
3 200000 778692316 514874758 255973743 588033932 819871573 260791253 705361234 300822781 335029828 999122805 340641653 669874726 950553606 661826319 977173987 437763829 319103220 181986477 918306559 91904102 568836713 542715205 855761155 582206231 138338201 356246876 615689171 994118730 547700980 65...
output:
202 660946 1049850 2509885 3057948 3112004 3447074 4204086 6192964 7159474 7751815 8199039 8991864 10990359 13362454 13780092 15223287 15796547 16673938 17279755 17399473 19414921 20407394 21841443 22711060 22843322 22939591 24337539 26710208 28089073 29290939 30211656 30669692 30953037 31143715 314...
result:
ok 3003 numbers
Test #59:
score: 0
Accepted
time: 618ms
memory: 13252kb
input:
3 200000 880186254 798493586 422009256 272485269 392121081 257480083 800402131 661074964 474619147 9388184 899579480 645166827 747903331 627139941 659223298 572255528 95317275 884307721 453673971 421504092 274296252 151514691 673060644 973771777 393630046 759700736 623125976 960550385 396876140 8618...
output:
252 847516 2192315 2551126 2763441 3622058 5807175 6104997 6893069 9388184 11348425 15668809 17496600 17527386 19419805 26243260 26421643 27448538 27451864 34846317 35249873 35947320 40272609 44313643 46094328 46703638 46837034 47396710 48961362 49204856 49315555 49388583 50680925 53680819 53944640 ...
result:
ok 2403 numbers
Test #60:
score: 0
Accepted
time: 787ms
memory: 14116kb
input:
3 200000 996939338 545406313 39213726 295203816 218420409 185837301 564149820 197807677 725589725 287360022 910986508 509076205 187636142 435232823 436957265 521738501 796301742 365009808 425884563 738904434 112616107 547233704 972478422 524280003 282327617 997061943 255532242 598101066 504645509 52...
output:
402 4991447 5240823 6484133 7896893 8033727 9746634 10473154 13408158 14475204 14910248 15919298 17247187 17548840 23147090 26646033 27116672 27196404 27241867 27406413 27918677 28744323 29664847 30745975 32797828 38205979 39213726 39264646 44276505 44888374 44944162 46031104 46853024 48350665 49836...
result:
ok 1503 numbers
Test #61:
score: 0
Accepted
time: 1346ms
memory: 13896kb
input:
3 200000 628167215 336585700 803490001 856592694 475400797 621252122 632588752 181295399 729698413 403060024 537565461 240340802 97169626 441349314 295021523 884740586 676151254 314290441 432860857 244106892 571330693 292071245 53434349 160039795 259356670 190039147 290108487 663106327 379137075 503...
output:
1002 6719745 12294483 16417369 17267131 31550161 37197205 38867200 39187944 50189504 53434349 56104785 56216084 68782746 71050768 79396287 92171325 97169626 103839480 107579261 117808821 128273642 131716135 144544019 151749450 159327278 160039795 164483908 165787743 171072951 181295399 183402557 190...
result:
ok 603 numbers
Test #62:
score: 0
Accepted
time: 1025ms
memory: 13876kb
input:
3 200000 489127840 632294512 812551058 942484803 953643046 490056974 230939751 66531611 488053062 704140429 516130103 553217979 770266402 12633038 763928143 258821689 413862270 176047615 625928433 68055190 808172291 179394490 948281868 929268239 839509846 774903726 77186881 105197197 686458213 83150...
output:
2002 6786500 12633038 56497559 64485256 66531611 68055190 77186881 77866716 85613281 103688570 105197197 109600457 120374382 126477066 131246764 139619491 148415062 176047615 179394490 193264682 209111867 215607765 222359205 230939751 242322397 247988998 252590293 258821689 301816570 308659507 31780...
result:
ok 303 numbers
Test #63:
score: 0
Accepted
time: 883ms
memory: 13872kb
input:
3 200000 308544082 468018187 497257687 351540771 335783361 80059957 351529413 712691028 988033803 715276556 877757606 170284385 9571391 772427261 96458479 450962624 594088888 686572118 40899567 285604829 128018625 639752345 206781251 227917285 700595416 677453478 665529063 169117461 688831839 348445...
output:
4002 9571391 14807692 40899567 68374007 73588957 80059957 96458479 128018625 146942236 169117461 169229608 170284385 206781251 220045181 227917285 243854701 263093275 281504132 285604829 285658883 308544082 329911555 335783361 348445598 351529413 351540771 409689242 450962624 462021745 467420990 468...
result:
ok 153 numbers
Test #64:
score: 0
Accepted
time: 881ms
memory: 14280kb
input:
3 200000 972885993 931477738 398279225 904417128 193448912 20479493 810800449 585005421 246730728 448761815 780544632 109644431 765787837 449508166 463974000 214512950 958527917 730496886 727798716 567324964 810800449 398279225 730496886 193448912 972885993 214512950 765787837 931477738 20479493 463...
output:
10002 20479493 109644431 193448912 214512950 246730728 398279225 448761815 449508166 463974000 567324964 585005421 727798716 730496886 765787837 780544632 810800449 904417128 931477738 958527917 972885993 10002 58862578 132029120 133776502 148022599 153425440 208569496 263161067 389349975 413447066 ...
result:
ok 63 numbers
Test #65:
score: 0
Accepted
time: 932ms
memory: 14084kb
input:
3 200000 932485357 713333844 266630271 416219542 351948710 576575915 281102816 308929524 15893252 796757152 308929524 796757152 416219542 351948710 713333844 932485357 15893252 266630271 281102816 576575915 932485357 416219542 796757152 281102816 351948710 15893252 266630271 576575915 308929524 7133...
output:
20002 15893252 266630271 281102816 308929524 351948710 416219542 576575915 713333844 796757152 932485357 20002 75038544 190267433 255256899 316074635 531929605 557323956 632351080 755079938 912418828 948070757 10002 173306289 262955254 386177130 506123637 518960701 521920324 528278277 767308558 7847...
result:
ok 33 numbers
Test #66:
score: 0
Accepted
time: 705ms
memory: 14192kb
input:
3 200000 314260836 705978493 705978493 314260836 705978493 314260836 314260836 705978493 314260836 705978493 705978493 314260836 314260836 705978493 705978493 314260836 705978493 314260836 705978493 314260836 314260836 705978493 705978493 314260836 314260836 705978493 705978493 314260836 314260836 7...
output:
100002 314260836 705978493 100002 663003084 707552093 50002 513121219 534583734
result:
ok 9 numbers
Test #67:
score: 0
Accepted
time: 2ms
memory: 10528kb
input:
20 2 269020466 71643169 2 623861571 549974128 2 305153739 535998968 2 484949904 300100324 2 799271801 890050768 2 970289922 115559041 2 826488703 568805295 2 46824192 970278757 2 160573076 605659670 2 440062969 501227031 2 653405639 863560932 2 159285144 236074209 2 449543617 684142936 2 41147371 67...
output:
2 71643169 269020466 2 549974128 623861571 2 305153739 535998968 2 300100324 484949904 2 799271801 890050768 2 115559041 970289922 2 568805295 826488703 2 46824192 970278757 2 160573076 605659670 2 440062969 501227031 2 653405639 863560932 2 159285144 236074209 2 449543617 684142936 2 41147371 67512...
result:
ok 60 numbers