QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#50441 | #4835. Mode | YaoBIG | AC ✓ | 2106ms | 8536kb | C++ | 3.0kb | 2022-09-26 03:45:30 | 2022-09-26 03:45:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = (int)1e9 + 7;
const int TRESHOLD = 600;
// returns number of elements strictly smaller than v in vec
template<class T>
int bins(const vector<T>& vec, T v) {
int low = 0;
int high = vec.size();
while(low != high) {
int mid = (low + high) >> 1;
if (vec[mid] < v) low = mid + 1;
else high = mid;
}
return low;
}
void offer(int v, int off, vector<int>& bst) {
bst[v] = max(bst[v], off);
}
void solve() {
int n;
cin >> n;
vector<int> as(n);
for (int& a : as) cin >> a;
vector<int> cmp = as;
sort(cmp.begin(), cmp.end());
cmp.erase(unique(cmp.begin(), cmp.end()), cmp.end());
for (int i = 0; i < n; ++i) as[i] = bins(cmp, as[i]);
int k = cmp.size();
vector<int> tot(k, 0), suff_max(n + 1, 0);
for (int i = n-1; i >= 0; --i) {
++tot[as[i]];
suff_max[i] = max(suff_max[i + 1], tot[as[i]]);
}
int h = 0;
for (int v : tot) h = max(h, v);
vector<int> pre(n), lst(k, -1);
for (int i = 0; i < n; ++i) {
pre[i] = lst[as[i]];
lst[as[i]] = i;
}
vector<int> ans(k, 0);
if (h >= TRESHOLD) {
// O(n^2 / h)
for (int v = 0; v < k; ++v) {
if (tot[v] < h/2) continue;
vector<int> cou(n + 1, 0);
for (int i = 0; i < n; ++i) cou[i + 1] = (cou[i] + (as[i] == v));
for (int v2 = 0; v2 < k; ++v2) {
if (v2 == v) continue;
vector<int> apps = {lst[v2]};
for (int j = pre[lst[v2]]; j >= 0; j = pre[j]) apps.push_back(j);
reverse(apps.begin(), apps.end());
// Have v2 on the inside
int bst = -INF;
for (int j = (int)apps.size() - 1; j >= 0; --j) {
bst = max(bst, j + 1 - cou[apps[j]]);
offer(v, tot[v] + bst - j + cou[apps[j]], ans);
// cerr << v << ' ' << v2 << ' ' << j << ' ' << apps[j] << ": " << tot[v] << ' ' << bst << ' ' << j << ' ' << cou[apps[j]] << '\n';
}
// Have v2 on the outside
bst = -INF;
for (int j = (int)apps.size() - 1; j >= 0; --j) {
bst = max(bst, cou[apps[j]] - j);
offer(v2, tot[v2] + bst + j + 1 - cou[apps[j]], ans);
// Simple offers
offer(v2, tot[v] + j+1 - cou[apps[j]], ans);
offer(v2, cou[apps[j]] + tot[v2] - j, ans);
}
}
}
} else {
// O(nh)
vector<int> counts = {n};
for (int i = 0; i < n; ++i) {
for (int a = 1, b = 0, j = pre[i]; a < counts.size(); ++a) {
while(counts[a] <= j) {
++b;
j = pre[j];
}
offer(as[i], tot[as[i]] + a - b, ans);
}
int cur = 0;
for (int j = i, cou = 1; j >= 0; j = pre[j], ++cou, ++cur) {
if (counts.size() <= cou) counts.emplace_back(j);
else counts[cou] = max(counts[cou], j);
}
offer(as[i], cur + suff_max[i + 1], ans);
}
}
int res = 0;
for (int v : ans) res = max(res, v);
cout << res << '\n';
for (int v = 0; v < k; ++v) {
if (ans[v] == res) cout << cmp[v] << ' '; cout << '\n';
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
for (int ti = 0; ti < t; ++ti) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3572kb
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: 3580kb
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 ...
result:
ok 24 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3668kb
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 2778524...
result:
ok 27 numbers
Test #4:
score: 0
Accepted
time: 3ms
memory: 3524kb
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 ...
result:
ok 27 numbers
Test #5:
score: 0
Accepted
time: 1ms
memory: 3568kb
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 2986...
result:
ok 29 numbers
Test #6:
score: 0
Accepted
time: 73ms
memory: 7780kb
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: 85ms
memory: 8008kb
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: 73ms
memory: 7832kb
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: 75ms
memory: 7964kb
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: 153ms
memory: 4416kb
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 ...
result:
ok 25213 numbers
Test #11:
score: 0
Accepted
time: 161ms
memory: 4280kb
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 ...
result:
ok 25218 numbers
Test #12:
score: 0
Accepted
time: 730ms
memory: 7144kb
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 ...
result:
ok 45168 numbers
Test #13:
score: 0
Accepted
time: 761ms
memory: 7208kb
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 ...
result:
ok 45201 numbers
Test #14:
score: 0
Accepted
time: 733ms
memory: 7216kb
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 ...
result:
ok 45117 numbers
Test #15:
score: 0
Accepted
time: 753ms
memory: 7088kb
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 ...
result:
ok 45236 numbers
Test #16:
score: 0
Accepted
time: 744ms
memory: 7132kb
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 ...
result:
ok 45125 numbers
Test #17:
score: 0
Accepted
time: 751ms
memory: 7220kb
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 ...
result:
ok 45140 numbers
Test #18:
score: 0
Accepted
time: 739ms
memory: 7216kb
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 ...
result:
ok 45186 numbers
Test #19:
score: 0
Accepted
time: 733ms
memory: 7060kb
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 ...
result:
ok 45135 numbers
Test #20:
score: 0
Accepted
time: 755ms
memory: 7080kb
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 ...
result:
ok 45144 numbers
Test #21:
score: 0
Accepted
time: 748ms
memory: 7144kb
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 ...
result:
ok 45135 numbers
Test #22:
score: 0
Accepted
time: 1403ms
memory: 6432kb
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 ...
result:
ok 27 numbers
Test #23:
score: 0
Accepted
time: 1408ms
memory: 6356kb
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 ...
result:
ok 27 numbers
Test #24:
score: 0
Accepted
time: 1401ms
memory: 6444kb
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 ...
result:
ok 25 numbers
Test #25:
score: 0
Accepted
time: 159ms
memory: 8536kb
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 ...
result:
ok 8 numbers
Test #26:
score: 0
Accepted
time: 154ms
memory: 7500kb
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 ...
result:
ok 13 numbers
Test #27:
score: 0
Accepted
time: 174ms
memory: 6320kb
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 ...
result:
ok 6 numbers
Test #28:
score: 0
Accepted
time: 235ms
memory: 6764kb
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 ...
result:
ok 8 numbers
Test #29:
score: 0
Accepted
time: 438ms
memory: 6396kb
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 ...
result:
ok 6 numbers
Test #30:
score: 0
Accepted
time: 534ms
memory: 6336kb
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 ...
result:
ok 6 numbers
Test #31:
score: 0
Accepted
time: 749ms
memory: 6336kb
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 ...
result:
ok 10 numbers
Test #32:
score: 0
Accepted
time: 888ms
memory: 6208kb
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 ...
result:
ok 6 numbers
Test #33:
score: 0
Accepted
time: 1392ms
memory: 6376kb
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 61...
result:
ok 6 numbers
Test #34:
score: 0
Accepted
time: 2070ms
memory: 7192kb
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 ...
result:
ok 6 numbers
Test #35:
score: 0
Accepted
time: 1018ms
memory: 7092kb
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 ...
result:
ok 6 numbers
Test #36:
score: 0
Accepted
time: 511ms
memory: 7216kb
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: 188ms
memory: 7316kb
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: 122ms
memory: 7412kb
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: 48ms
memory: 7964kb
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: 170ms
memory: 7644kb
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 ...
result:
ok 300003 numbers
Test #41:
score: 0
Accepted
time: 180ms
memory: 6352kb
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 ...
result:
ok 814 numbers
Test #42:
score: 0
Accepted
time: 243ms
memory: 6472kb
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 ...
result:
ok 8 numbers
Test #43:
score: 0
Accepted
time: 425ms
memory: 6340kb
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 ...
result:
ok 9 numbers
Test #44:
score: 0
Accepted
time: 526ms
memory: 6376kb
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 ...
result:
ok 6 numbers
Test #45:
score: 0
Accepted
time: 739ms
memory: 6424kb
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 ...
result:
ok 8 numbers
Test #46:
score: 0
Accepted
time: 875ms
memory: 6284kb
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 ...
result:
ok 6 numbers
Test #47:
score: 0
Accepted
time: 1355ms
memory: 6356kb
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 ...
result:
ok 6 numbers
Test #48:
score: 0
Accepted
time: 2106ms
memory: 7236kb
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 ...
result:
ok 6 numbers
Test #49:
score: 0
Accepted
time: 1003ms
memory: 7060kb
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 ...
result:
ok 7 numbers
Test #50:
score: 0
Accepted
time: 503ms
memory: 7188kb
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: 189ms
memory: 7436kb
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: 125ms
memory: 7476kb
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: 54ms
memory: 7960kb
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: 159ms
memory: 7564kb
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 29758...
result:
ok 299977 numbers
Test #55:
score: 0
Accepted
time: 147ms
memory: 6444kb
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 ...
result:
ok 30003 numbers
Test #56:
score: 0
Accepted
time: 304ms
memory: 6340kb
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...
result:
ok 6003 numbers
Test #57:
score: 0
Accepted
time: 384ms
memory: 6376kb
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 2581454...
result:
ok 4503 numbers
Test #58:
score: 0
Accepted
time: 531ms
memory: 6372kb
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 ...
result:
ok 3003 numbers
Test #59:
score: 0
Accepted
time: 631ms
memory: 6296kb
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 493885...
result:
ok 2403 numbers
Test #60:
score: 0
Accepted
time: 941ms
memory: 6264kb
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 46...
result:
ok 1503 numbers
Test #61:
score: 0
Accepted
time: 2007ms
memory: 7208kb
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 17107...
result:
ok 603 numbers
Test #62:
score: 0
Accepted
time: 1057ms
memory: 7240kb
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 25882168...
result:
ok 303 numbers
Test #63:
score: 0
Accepted
time: 584ms
memory: 7220kb
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 450962...
result:
ok 153 numbers
Test #64:
score: 0
Accepted
time: 197ms
memory: 7456kb
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 2631...
result:
ok 63 numbers
Test #65:
score: 0
Accepted
time: 117ms
memory: 7428kb
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...
result:
ok 33 numbers
Test #66:
score: 0
Accepted
time: 57ms
memory: 8020kb
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: 3552kb
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 6...
result:
ok 60 numbers