QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#425873 | #1443. Potato Shuffle | grass8cow# | AC ✓ | 83ms | 37012kb | C++17 | 2.5kb | 2024-05-30 17:57:04 | 2024-05-30 17:57:04 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7,I=1e9+10;
int n,k,a[201000];
#define pi pair<int,int>
#define fi first
#define se second
struct SGT{
pi mi[801000];
void sc(int p){mi[p]=min(mi[p<<1],mi[p<<1|1]);}
inline void build(int p,int l,int r,int ty){
if(l==r){mi[p]={a[l]*ty,l};return;}
int mid=(l+r)>>1;
build(p<<1,l,mid,ty),build(p<<1|1,mid+1,r,ty);
sc(p);
}
inline void up(int p,int l,int r,int x,int z){
if(l==r){mi[p]={z,l};return;}
int mid=(l+r)>>1;
if(x<=mid)up(p<<1,l,mid,x,z);
else up(p<<1|1,mid+1,r,x,z);
sc(p);
}
inline pi ask(int p,int l,int r,int x,int y){
if(x<=l&&r<=y)return mi[p];
int mid=(l+r)>>1;
pi nt={I,-1};
if(x<=mid)nt=min(nt,ask(p<<1,l,mid,x,y));
if(y>mid)nt=min(nt,ask(p<<1|1,mid+1,r,x,y));
return nt;
}
}A,B;
struct BIT{
int tr[201000];
inline void ad(int x,int z){for(;x<=n;x+=(x&-x))tr[x]+=z;}
inline int ask(int x){int s=0;for(;x;x-=(x&-x))s+=tr[x];return s;}
}T;
void cl(int x){A.up(1,1,n,x,I),B.up(1,1,n,x,I),T.ad(x,-1);}
int ans,jc[200100],ij[200100],inv[201000];
#define pb push_back
int C(int a,int b){if(a<0||b<0||a<b)return 0;return 1ll*jc[a]*ij[b]%mod*ij[a-b]%mod;}
void cdq(int l,int r){
if(l>r)return;
pi t1=A.ask(1,1,n,l,r);if(t1.fi>=I)return;
pi t2=B.ask(1,1,n,l,r);
int wc=T.ask(r)-T.ask(l-1);
if(t1.fi-t2.fi<=k){
//找到所有最小值并删去。
int o=l;
vector<int>P;
while(o<=r){
pi z=A.ask(1,1,n,o,r);
if(z.fi==t1.fi)P.pb(z.se),o=z.se+1;
else break;
}
for(int x:P)cl(x);
ans=1ll*ans*C(wc,(int)P.size())%mod;
cdq(l,r);return;
}
else{
int o=l;
vector<int>P;
while(o<=r){
pi z=B.ask(1,1,n,o,r);
if(z.fi==t2.fi)P.pb(z.se),o=z.se+1;
else break;
}
int sz=P.size();
for(int i=0;i<=sz;i++)cdq((i==0)?l:(P[i-1]+1),(i==sz)?r:(P[i]-1));
}
}
int main(){
scanf("%d%d",&n,&k);
ans=1;
inv[1]=1;
for(int i=2;i<=n;i++)inv[i]=mod-1ll*inv[mod%i]*(mod/i)%mod;
jc[0]=ij[0]=1;
for(int i=1;i<=n;i++)jc[i]=1ll*i*jc[i-1]%mod,ij[i]=1ll*inv[i]*ij[i-1]%mod,T.ad(i,1);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
A.build(1,1,n,1),B.build(1,1,n,-1);
cdq(1,n);printf("%d",ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 9944kb
input:
3 7 5 2 4
output:
3
result:
ok "3"
Test #2:
score: 0
Accepted
time: 1ms
memory: 9948kb
input:
5 4 1 2 3 2 1
output:
10
result:
ok "10"
Test #3:
score: 0
Accepted
time: 0ms
memory: 10280kb
input:
6 4 9 10 1 9 8 9
output:
1
result:
ok "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 10060kb
input:
8 0 4 9 2 9 2 3 9 10
output:
1
result:
ok "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 10044kb
input:
5 3 9 8 1 9 8
output:
1
result:
ok "1"
Test #6:
score: 0
Accepted
time: 2ms
memory: 9988kb
input:
6 12 4 7 2 9 1 9
output:
60
result:
ok "60"
Test #7:
score: 0
Accepted
time: 1ms
memory: 10060kb
input:
10 18 9 6 3 9 5 3 9 9 5 1
output:
37800
result:
ok "37800"
Test #8:
score: 0
Accepted
time: 0ms
memory: 9976kb
input:
1 13 5
output:
1
result:
ok "1"
Test #9:
score: 0
Accepted
time: 2ms
memory: 10264kb
input:
4 7 10 4 4 8
output:
1
result:
ok "1"
Test #10:
score: 0
Accepted
time: 2ms
memory: 12016kb
input:
2 4 3 3
output:
1
result:
ok "1"
Test #11:
score: 0
Accepted
time: 2ms
memory: 9944kb
input:
3 12 8 1 6
output:
3
result:
ok "3"
Test #12:
score: 0
Accepted
time: 1ms
memory: 7932kb
input:
9 3 3 10 5 8 9 1 3 1 9
output:
1
result:
ok "1"
Test #13:
score: 0
Accepted
time: 1ms
memory: 9972kb
input:
10 19 8 9 6 8 3 5 8 8 8 2
output:
30240
result:
ok "30240"
Test #14:
score: 0
Accepted
time: 0ms
memory: 10280kb
input:
3 8 3 8 7
output:
1
result:
ok "1"
Test #15:
score: 0
Accepted
time: 0ms
memory: 9976kb
input:
5 6 8 7 6 8 3
output:
1
result:
ok "1"
Test #16:
score: 0
Accepted
time: 0ms
memory: 10040kb
input:
10 4 4 6 7 7 7 5 10 8 9 5
output:
1
result:
ok "1"
Test #17:
score: 0
Accepted
time: 2ms
memory: 9972kb
input:
3 5 9 5 8
output:
1
result:
ok "1"
Test #18:
score: 0
Accepted
time: 0ms
memory: 9956kb
input:
1 15 4
output:
1
result:
ok "1"
Test #19:
score: 0
Accepted
time: 1ms
memory: 10280kb
input:
4 0 9 2 8 9
output:
1
result:
ok "1"
Test #20:
score: 0
Accepted
time: 2ms
memory: 10060kb
input:
7 10 4 1 9 9 7 8 6
output:
7
result:
ok "7"
Test #21:
score: 0
Accepted
time: 0ms
memory: 10244kb
input:
9 15 9 10 10 9 1 2 2 9 3
output:
1512
result:
ok "1512"
Test #22:
score: 0
Accepted
time: 1ms
memory: 9988kb
input:
2 12 4 9
output:
1
result:
ok "1"
Test #23:
score: 0
Accepted
time: 2ms
memory: 10292kb
input:
941 1050595461 97199151 967582202 627391061 648812583 382698254 725831431 99920429 942104929 638728093 697787100 277585567 423990676 376336278 986391434 449561958 800545732 3456798 386231691 307296784 129242596 740319256 218489131 899192544 344153713 971619078 363368462 206242305 149813823 430534965...
output:
731201602
result:
ok "731201602"
Test #24:
score: 0
Accepted
time: 2ms
memory: 10072kb
input:
931 1802136692 972656407 966750261 14838713 725079303 96491328 170902145 865911285 121473856 881400060 115397807 343248192 713973122 693395876 845120872 810689262 697741053 598095593 117050186 62294356 887558804 107838689 348014209 207407232 962013618 291145455 44153613 619738233 106508008 266410860...
output:
910622578
result:
ok "910622578"
Test #25:
score: 0
Accepted
time: 2ms
memory: 10280kb
input:
908 396822628 848113662 965918320 549770012 801346023 810284401 763456507 631902141 300842783 124072027 680492162 556394465 3955568 10455474 556366661 171816567 594936374 340218037 700385033 669808280 498391365 475358123 477539288 515621920 579873524 758155480 724938765 885750512 63202193 102286755 ...
output:
701616507
result:
ok "701616507"
Test #26:
score: 0
Accepted
time: 2ms
memory: 10276kb
input:
982 853189715 723570917 965086379 937217663 877612742 376593827 208527221 250409349 627695358 219260346 98102870 622057090 146454365 180031424 415096098 532943871 492131696 82340480 431203528 424805851 256707574 842877556 607064367 971320257 197733429 225165505 405723916 151762792 19896379 790679002...
output:
544386726
result:
ok "544386726"
Test #27:
score: 0
Accepted
time: 2ms
memory: 8204kb
input:
967 1909276738 599028172 964254438 324665314 953879462 90386901 653597935 16400205 807064286 461932313 515713577 835203363 436436811 497091022 126341888 894071176 389327017 676979275 14538376 32319775 15023782 62913342 736589445 279534945 963076983 692175531 86509067 565258719 976590564 626554897 15...
output:
357737423
result:
ok "357737423"
Test #28:
score: 0
Accepted
time: 2ms
memory: 10064kb
input:
944 583017422 474485427 963422497 859596613 30146182 804179975 98668649 782391061 133916861 704604280 80807933 900865988 726419257 814150620 985071325 107714832 286522338 419101719 745356871 787317347 625856343 430432775 866114524 587749633 580936888 11701908 914777867 831270999 933284749 314947143 ...
output:
104969714
result:
ok "104969714"
Test #29:
score: 0
Accepted
time: 0ms
memory: 10088kb
input:
966 1419020255 349942682 962590556 247044264 106412902 370489401 691223011 400898269 313285788 947276247 498418640 114012261 16401703 131210218 843800763 468842137 183717659 13740514 476175366 542314919 384172552 797952209 995639603 43447969 198796794 478711933 595563018 97283279 889978934 150823038...
output:
191526560
result:
ok "191526560"
Test #30:
score: 0
Accepted
time: 2ms
memory: 9912kb
input:
937 28727278 225399937 961758615 634491915 182679622 84282475 136293725 166889124 492654715 189948214 916029348 179674886 306384149 448269816 555046552 829969441 80912980 755862957 59510213 149828842 142488760 165471642 125164682 351662657 816656699 945721958 276348169 510779206 846673120 986698933 ...
output:
2
result:
ok "2"
Test #31:
score: 0
Accepted
time: 2ms
memory: 10056kb
input:
972 1593462784 100857193 960926673 21939566 258946342 798075549 581364439 932879980 819507290 432620180 333640055 245337511 596366594 765329414 413775990 191096746 125591950 497985401 790328708 904826414 753321321 532991076 254689760 659877345 434516605 412731983 957133321 776791486 803367305 675091...
output:
12821673
result:
ok "12821673"
Test #32:
score: 0
Accepted
time: 2ms
memory: 10000kb
input:
902 840152080 123798096 960094732 556870865 335213062 364384975 26435153 551387188 998876217 675292147 898734411 458483784 886349040 82389012 125021779 552224050 22787271 92624196 521147204 659823986 511637530 900510509 384214839 115575682 52376510 879742008 637918472 42803765 760061490 510967075 35...
output:
290207909
result:
ok "290207909"
Test #33:
score: 0
Accepted
time: 55ms
memory: 16064kb
input:
99981 383768740 237478326 322155407 930205508 175719580 46601058 72194070 539064593 171732827 31512372 839584010 736436026 831898546 174986629 492779329 927429376 418061443 998737915 494032461 573397444 142213421 773140630 33036917 59337299 266923244 210685670 593110757 777225043 968678142 576736689...
output:
645574592
result:
ok "645574592"
Test #34:
score: 0
Accepted
time: 49ms
memory: 14580kb
input:
99961 74244242 112935581 321323466 317653159 251986300 760394132 664748432 157571801 498585402 274184339 257194717 949582299 121880991 492046227 351508767 288556680 315256764 593376710 224850956 328395016 900529630 140660063 162561995 367551987 32266798 677695695 273895908 43237322 925372327 2651289...
output:
903323650
result:
ok "903323650"
Test #35:
score: 0
Accepted
time: 65ms
memory: 24784kb
input:
99912 1351217021 135876485 320491525 852584458 328253020 474187206 109819146 923562657 677954329 516856306 674805425 15244924 264379789 809105825 62754556 649683985 212452085 335499153 955669452 83392588 658845838 360695849 292087074 675766675 650126703 144705720 954681060 456733250 882066513 101004...
output:
107053777
result:
ok "107053777"
Test #36:
score: 0
Accepted
time: 66ms
memory: 16024kb
input:
99939 1031361422 11333740 319659583 240032109 404519739 40496632 554889860 689553513 4806905 759528272 92416132 80907549 554362235 126165423 921483993 10811289 109647406 77621597 539004299 690906511 269678399 728215282 421612153 131465011 267986609 464232097 635466211 722745530 838760698 936880725 5...
output:
756974237
result:
ok "756974237"
Test #37:
score: 0
Accepted
time: 69ms
memory: 15256kb
input:
99949 376289183 886790995 318827642 627479760 480786459 754289706 147444222 308060721 184175832 2200239 657510488 294053822 844344681 443225021 780213431 224454946 6842727 672260392 269822794 445904083 27994608 95734716 551137232 439679699 885846514 931242122 316251362 136241457 795454883 625272972 ...
output:
762184396
result:
ok "762184396"
Test #38:
score: 0
Accepted
time: 72ms
memory: 21420kb
input:
99904 1224809391 762248250 317995701 14927411 557053179 468082779 592514936 74051577 363544759 97388558 75121195 359716447 134327127 760284619 491459220 585582250 904038049 414382836 641289 53418007 786310816 463254149 680662310 747894388 503706420 398252147 144520162 402253737 752149069 461148867 9...
output:
902010674
result:
ok "902010674"
Test #39:
score: 0
Accepted
time: 54ms
memory: 15120kb
input:
99999 330137664 637705505 317163760 549858710 633319899 34392205 37585650 840042432 690397334 340060525 492731903 572862720 424309572 77344217 350188658 946709555 801233370 9021631 583976136 808415579 397143377 830773583 810187389 56109076 121566325 865262173 825305313 668266016 708843254 149541114 ...
output:
932661618
result:
ok "932661618"
Test #40:
score: 0
Accepted
time: 83ms
memory: 33804kb
input:
99985 1850022960 513162760 316331819 937306361 709586619 748185279 482656364 458549640 869766261 582732492 57826258 638525345 714292018 246920167 61434447 307836859 698428691 751144074 314794632 563413150 155459586 50809368 939712468 511807412 886909879 184788550 506090464 81761944 665537439 9854170...
output:
567106457
result:
ok "567106457"
Test #41:
score: 0
Accepted
time: 57ms
memory: 14824kb
input:
99964 980924447 388620015 315499878 324754012 785853339 461978353 75210726 224540496 49135188 825404459 475436965 851671618 4274464 563979765 920163884 668964164 595624012 493266518 45613127 170927074 913775794 418328802 69237546 820022100 504769784 651798575 186875616 347774223 622231625 821292903 ...
output:
183801686
result:
ok "183801686"
Test #42:
score: 0
Accepted
time: 79ms
memory: 32208kb
input:
99969 1780700175 264077270 314667937 859685311 862120059 28287779 520281440 990531352 375987763 68076426 893047673 917334243 146773262 881039363 778893322 30091469 492819333 87905313 628947974 925924646 524608355 785848235 51278977 128236788 122629690 118808600 867660767 613786503 578925810 50968515...
output:
645659292
result:
ok "645659292"
Test #43:
score: 0
Accepted
time: 50ms
memory: 15260kb
input:
99951 102625278 139534526 313835996 247132962 938386779 742080853 965352154 609038560 555356690 310748393 310658380 130480516 436755708 198098961 490139111 243735125 390014655 830027756 359766469 680922218 282924564 153367669 180804056 583935124 740489595 585818625 548445919 27282430 535619995 34556...
output:
1681919
result:
ok "1681919"
Test #44:
score: 0
Accepted
time: 69ms
memory: 28084kb
input:
99956 1576170515 14991781 313004054 634580614 14653498 455873927 410422868 375029416 882209266 553420360 875752736 196143141 726738153 515158559 348868549 604862430 287209976 572150200 90584964 288436141 41240772 520887102 310329134 892149813 358349501 52828650 229231070 293294710 492314181 33953292...
output:
23672762
result:
ok "23672762"
Test #45:
score: 0
Accepted
time: 60ms
memory: 15144kb
input:
99986 835442723 890449036 312172113 22028265 90920218 22183353 2977230 141020272 61578193 796092326 293363443 261805766 16720599 832218157 60114338 965989734 184405297 166788995 673919812 43433713 652073333 888406535 439854213 200364501 123693054 372355027 57499869 559306990 449008366 869829187 1408...
output:
429369468
result:
ok "429369468"
Test #46:
score: 0
Accepted
time: 58ms
memory: 15052kb
input:
99931 630733876 765906291 311340172 556959564 19703290 735976427 448047943 759527480 240947120 38764293 710974151 474952039 306703045 1794107 918843775 327117039 81600618 908911438 404738307 798431285 410389542 108442321 569379292 656062837 741552959 839365053 738285021 972802917 405702551 705705082...
output:
113862
result:
ok "113862"
Test #47:
score: 0
Accepted
time: 69ms
memory: 22716kb
input:
99904 1303093316 641363546 310508231 944407215 95970010 449769501 893118657 525518336 567799695 133952612 128584858 540614664 596685491 318853705 777573213 688244343 126279587 651033882 135556802 405945208 21222102 475961754 698904371 964277525 359412865 306375078 419070172 238815197 362396736 39409...
output:
754493933
result:
ok "754493933"
Test #48:
score: 0
Accepted
time: 44ms
memory: 15084kb
input:
99978 163775573 516820801 309676290 331854866 172236730 16078927 338189371 144025544 747168622 376624579 693679214 753760937 886667937 635913303 488819002 49371648 23474908 245672677 718891649 160942780 779538311 843481188 828429449 272492213 977272770 773385103 99855323 504827476 319090922 22997322...
output:
26845342
result:
ok "26845342"
Test #49:
score: 0
Accepted
time: 65ms
memory: 27440kb
input:
99953 1540134811 392278056 308844349 866786165 248503450 729872001 930743733 910016400 74021197 619296546 111289921 819423562 29166734 952972901 347548440 263015304 920670230 987795120 449710145 915940352 537854520 211000621 957954528 728190549 595132676 92911480 780640475 918323404 275785107 658491...
output:
990218938
result:
ok "990218938"
Test #50:
score: 0
Accepted
time: 70ms
memory: 23388kb
input:
99936 1322988426 267735312 308012408 254233816 324770170 443665075 375814447 676007255 253390124 861968513 528900629 32569835 319149180 270032498 58794229 624142609 817865551 729917564 33044992 523454276 148687081 578520055 87479607 36405238 212992581 559921505 461425626 184335683 232479292 75424136...
output:
21205567
result:
ok "21205567"
Test #51:
score: 0
Accepted
time: 50ms
memory: 15032kb
input:
99950 109001593 143192567 307180467 641681467 401036890 9974501 820885161 294514463 432759051 104640480 93994984 98232460 609131626 587092096 917523667 985269913 715060872 324556359 763863487 278451847 907003289 946039488 217004685 344619926 978336135 26931530 142210777 450347963 189173478 590117260...
output:
461097384
result:
ok "461097384"
Test #52:
score: 0
Accepted
time: 49ms
memory: 13192kb
input:
99905 42298217 18649822 306348526 29129118 477303610 723767575 265955875 60505319 759611627 347312447 511605691 163895085 899114072 904151694 776253104 346397218 612256193 66678802 494681982 33449419 665319498 166075274 346529764 800318262 596196040 493941555 970479577 863843891 145867663 278509507 ...
output:
193608181
result:
ok "193608181"
Test #53:
score: 0
Accepted
time: 57ms
memory: 15232kb
input:
99975 99976 68507 88691 64840 78737 77265 31725 40448 77267 52242 37642 5127 95889 7427 60315 82930 21027 33229 82829 28459 30958 57537 39286 5074 47589 72690 80427 7590 72563 24285 32226 42891 6448 51659 22288 24354 3670 95779 39293 79178 25391 31951 11697 30393 99319 44171 28027 64362 51326 18359 ...
output:
506686434
result:
ok "506686434"
Test #54:
score: 0
Accepted
time: 60ms
memory: 13280kb
input:
99958 99959 5781 80810 49077 50960 87858 42728 88361 89425 43501 63437 11981 56927 93144 76824 36579 59136 63256 81462 3201 36401 46996 48358 62384 6540 76103 78507 59601 34420 64397 83127 69807 21312 71449 16596 27071 58784 88122 51114 77324 85425 81133 7019 64789 92705 31072 72858 69669 76508 1188...
output:
306697436
result:
ok "306697436"
Test #55:
score: 0
Accepted
time: 56ms
memory: 14820kb
input:
99917 99918 33582 21846 42699 70038 93808 89043 61022 37639 70809 4593 69610 83556 58213 31211 77118 20667 91806 64320 31801 56925 45944 31217 49451 96003 24380 47017 78698 72696 52914 4716 27613 48060 57032 64661 74999 88171 52628 48559 70717 66598 46703 83752 84506 39945 1532 91558 53155 331 4925 ...
output:
299595848
result:
ok "299595848"
Test #56:
score: 0
Accepted
time: 60ms
memory: 14864kb
input:
99911 99912 67978 47374 7551 24491 88477 53964 96378 46625 66886 55004 8634 22165 65771 9244 73082 24465 90114 92552 42823 8527 55344 4278 75928 90865 68116 52686 56582 50347 85259 96630 12724 71231 16243 92382 59177 19655 26404 39593 6412 61832 78057 53206 80324 79666 50427 27083 91610 97918 40737 ...
output:
484686701
result:
ok "484686701"
Test #57:
score: 0
Accepted
time: 61ms
memory: 15000kb
input:
99958 99959 21336 51522 92830 98256 61922 48690 37303 27519 4288 66025 32266 85497 32385 99414 13789 61956 92753 8213 64519 29796 86984 3187 15643 36902 77496 84134 26518 63344 75596 30697 56343 45190 77669 72238 88845 8617 97259 52098 72979 59702 73305 72421 62453 74300 20494 87192 23407 69306 7236...
output:
212485846
result:
ok "212485846"
Test #58:
score: 0
Accepted
time: 56ms
memory: 15296kb
input:
99957 99958 92442 75840 26820 7852 7475 26967 14641 43887 20539 58211 17876 34947 54591 23619 18093 34067 51822 98322 54723 27515 99826 92422 31316 22998 27666 17482 29916 16066 70014 6204 260 35691 66573 9547 53962 2911 5876 25012 40905 60805 39554 51010 12484 98801 85478 25797 37704 3900 77401 739...
output:
502807727
result:
ok "502807727"
Test #59:
score: 0
Accepted
time: 61ms
memory: 15184kb
input:
99933 99934 16815 49593 94050 70680 2438 41632 58737 38500 18399 10790 1445 49752 4082 58965 47761 89989 45129 57618 71843 11184 3218 63184 36031 54585 18644 28176 30960 71925 20520 91492 30374 39386 2697 93939 94630 17943 68101 99125 75718 72006 12237 32709 67559 67668 12120 9718 50652 29516 69417 ...
output:
510243634
result:
ok "510243634"
Test #60:
score: 0
Accepted
time: 57ms
memory: 14836kb
input:
99990 99991 5106 42503 49072 55941 13637 50329 75028 71032 2062 783 17550 81599 16425 41939 29682 77111 14392 36613 98835 33836 10161 71124 64108 71067 29732 29711 18347 85042 87894 78398 72934 96728 84818 88440 1094 77770 61021 73065 28322 61904 68982 31832 79768 90558 43974 17165 22432 80413 19968...
output:
589981140
result:
ok "589981140"
Test #61:
score: 0
Accepted
time: 57ms
memory: 15140kb
input:
99999 100000 24299 54797 84880 60132 27312 24112 7978 90663 79026 58927 99473 22759 9129 99925 49469 50880 2060 32413 4791 24583 87008 97168 16348 29021 58819 37991 35722 38112 90960 23003 44473 86435 76291 59118 9959 7779 12 90160 18736 32199 58324 76968 24562 96357 40487 65855 99868 68514 73219 30...
output:
732339361
result:
ok "732339361"
Test #62:
score: 0
Accepted
time: 57ms
memory: 15260kb
input:
99901 99902 93697 61308 72778 669 14434 296 35052 11746 22830 62382 98986 71427 52120 17193 71782 53704 66860 36958 16115 46281 60195 78520 46296 51532 94160 30122 64825 39436 5833 836 70874 91056 75847 7950 38489 94146 75686 54131 82558 6204 27207 26917 1480 73736 20694 82984 81546 61119 33023 6783...
output:
976769384
result:
ok "976769384"
Test #63:
score: 0
Accepted
time: 46ms
memory: 15088kb
input:
99991 1000000045 1000000000 100000006 500000044 300000030 700000000 700000000 600000035 600000035 199999925 800000022 199999925 1000000000 400000056 300000030 300000030 400000056 700000000 100000006 700000000 400000056 500000044 1000000000 600000035 800000022 1000000000 199999925 600000035 600000035...
output:
340458129
result:
ok "340458129"
Test #64:
score: 0
Accepted
time: 46ms
memory: 14964kb
input:
99931 1000000014 1000000000 299999929 199999980 800000020 100000063 600000002 399999930 199999980 299999929 600000002 100000063 100000063 500000052 500000052 700000025 900000000 600000002 1000000000 299999929 100000063 299999929 800000020 1000000000 600000002 600000002 700000025 700000025 500000052 ...
output:
990726496
result:
ok "990726496"
Test #65:
score: 0
Accepted
time: 52ms
memory: 15420kb
input:
99977 999999940 1000000000 499999908 599999920 599999920 99999968 499999908 800000018 599999920 599999920 700000098 499999908 700000098 800000018 499999908 1000000000 700000098 200000035 899999905 99999968 800000018 1000000000 399999956 99999968 99999968 99999968 1000000000 399999956 1000000000 8000...
output:
862326348
result:
ok "862326348"
Test #66:
score: 0
Accepted
time: 48ms
memory: 15196kb
input:
99920 999999996 800000016 100000074 899999961 999999928 100000074 499999964 100000074 600000087 899999961 200000090 499999964 999999928 999999928 100000074 100000074 300000031 300000031 600000087 300000031 200000090 100000074 100000074 600000087 800000016 899999961 899999961 800000016 899999961 9999...
output:
834283143
result:
ok "834283143"
Test #67:
score: 0
Accepted
time: 53ms
memory: 13160kb
input:
99963 1000000071 800000014 699999996 600000054 199999994 499999972 699999996 499999972 600000054 99999931 900000066 499999972 499999972 999999924 300000083 699999996 499999972 999999924 900000066 99999931 999999924 300000083 800000014 699999996 900000066 900000066 399999904 600000054 399999904 39999...
output:
362599284
result:
ok "362599284"
Test #68:
score: 0
Accepted
time: 52ms
memory: 15260kb
input:
99847 1000000055 190000084 420000097 469999910 19999974 209999961 960000033 789999970 339999941 260000065 829999943 859999901 209999961 540000047 649999998 559999931 59999965 430000014 49999967 809999903 9999966 960000033 729999928 39999908 609999914 119999968 39999908 439999910 129999919 270000009 ...
output:
27955142
result:
ok "27955142"
Test #69:
score: 0
Accepted
time: 61ms
memory: 15008kb
input:
99842 1000000080 710000074 910000031 589999974 690000041 540000027 410000098 890000014 890000014 989999999 279999936 879999984 60000084 869999930 640000053 200000096 600000092 229999914 60000084 690000041 329999983 739999987 500000065 479999915 210000050 149999940 640000053 839999935 730000033 48999...
output:
704247643
result:
ok "704247643"
Test #70:
score: 0
Accepted
time: 60ms
memory: 15544kb
input:
99885 999999955 439999980 489999945 610000083 189999952 70000030 60000051 450000091 360000036 799999941 949999950 899999943 539999958 460000061 570000089 300000047 320000077 959999958 370000002 40000008 639999913 519999977 549999933 209999939 919999997 489999945 80000015 429999979 409999939 40000008...
output:
854841486
result:
ok "854841486"
Test #71:
score: 0
Accepted
time: 59ms
memory: 14736kb
input:
99863 999999902 819999996 500000091 70000055 839999951 170000084 580000029 170000084 860000065 70000055 329999930 50000039 329999930 420000021 319999932 309999909 439999991 839999951 560000050 599999939 919999959 439999991 1000000000 199999903 239999928 490000003 199999903 549999929 529999982 770000...
output:
412069247
result:
ok "412069247"
Test #72:
score: 0
Accepted
time: 52ms
memory: 14804kb
input:
99737 999999992 300000038 339999939 510000074 949999964 899999941 540000021 390000019 679999929 420000031 189999972 890000057 219999942 30000035 260000006 580000094 330000080 500000003 129999967 169999989 150000027 300000038 469999966 189999972 229999902 709999953 550000077 650000050 39999908 949999...
output:
948002880
result:
ok "948002880"
Test #73:
score: 0
Accepted
time: 61ms
memory: 14816kb
input:
98589 999999963 665000007 1000000000 789000012 321999968 613999919 286000054 910999923 14000006 769999919 932999926 894000039 271000055 298999945 31999911 55999943 824000070 362000060 868999973 720000057 201000085 491000025 194000031 537999927 42999941 475000028 614999939 548000023 877999963 4900000...
output:
405158944
result:
ok "405158944"
Test #74:
score: 0
Accepted
time: 61ms
memory: 14852kb
input:
98680 999999907 394000065 573000006 182999977 704999982 346999992 905999995 331999992 450000032 863999996 739999904 546000027 721999919 734000081 440000014 937000030 992000086 300999909 418999908 158999932 72000083 295999978 841999942 422000001 891999980 844999992 59999969 940999975 601000089 622999...
output:
823431129
result:
ok "823431129"
Test #75:
score: 0
Accepted
time: 60ms
memory: 13480kb
input:
98312 1000000062 182999937 905000069 381999953 479000055 353999944 947000098 567999996 759999925 404000040 47000068 640999931 648000076 657999982 98000005 109999938 577999926 62000045 500999984 792000029 395000030 906999954 695000037 511000098 90000027 888000032 375999931 197000042 228999919 5309999...
output:
940668433
result:
ok "940668433"
Test #76:
score: 0
Accepted
time: 56ms
memory: 14832kb
input:
98556 999999958 480999934 585000009 298999982 105000027 711000066 746000055 308999974 290999999 420999944 896999964 666000013 956000036 908999908 339000029 660999932 414000082 766999938 730999998 211999981 925000062 907999907 936999951 193000035 375999941 850000038 599000009 766999938 705000076 7079...
output:
56961123
result:
ok "56961123"
Test #77:
score: 0
Accepted
time: 57ms
memory: 15364kb
input:
98371 1000000078 903000095 885999960 393000068 661000043 203000095 409999922 219000045 34000002 621000048 535999973 485000046 989999951 396000042 976999922 485000046 986000073 609999957 439999974 151999913 807999985 399000055 582000039 924999997 482000038 625000023 192999954 632999903 492000081 6110...
output:
19379526
result:
ok "19379526"
Test #78:
score: 0
Accepted
time: 53ms
memory: 14876kb
input:
86607 1000000083 294000063 976999973 424599988 469899967 844100060 647799988 321400040 683799936 674099905 630499966 467599918 267700014 77099981 127799951 825900023 849200060 917200011 18500076 65000035 574199928 427499989 72200010 351699927 169799900 438899995 520600058 335900096 215600098 5415999...
output:
693905149
result:
ok "693905149"
Test #79:
score: 0
Accepted
time: 49ms
memory: 15032kb
input:
85319 1000000095 517000085 152099912 578500048 271099948 317899968 908800023 713900092 652700009 550999910 262199997 460099970 569800058 781600069 654999931 717200083 914899985 786199991 942599992 895099922 318900040 366599970 877600002 640499960 270899981 388500002 51099985 982800003 983500043 8515...
output:
750259015
result:
ok "750259015"
Test #80:
score: 0
Accepted
time: 51ms
memory: 15224kb
input:
85707 1000000097 568600066 28900034 380899959 596499931 922600004 659699951 242900062 913200035 847799974 969499993 524099905 459699981 831000002 5199935 724999948 37899949 746500034 180599953 603799970 369699936 607899993 355700087 143700065 267999914 996399983 412699998 604299945 629099909 4414999...
output:
64822698
result:
ok "64822698"
Test #81:
score: 0
Accepted
time: 53ms
memory: 14860kb
input:
85826 999999978 25999912 652200020 794200030 978300070 778899996 439200019 560799906 650000045 826100094 845100002 901899965 479100040 399700063 12699903 44199954 771800022 547399965 395899966 641700082 230000019 333900045 199499932 557499996 366499982 423499902 384800033 743700049 912699915 3328999...
output:
315330162
result:
ok "315330162"
Test #82:
score: 0
Accepted
time: 45ms
memory: 14836kb
input:
86525 1000000003 565899999 267000030 852400096 536000001 17399939 747600071 821600064 529399981 401500078 502900050 697400079 426099915 581600080 451100061 823999992 747700017 329800005 898900046 912900088 336400071 633600032 687000093 55100082 632300056 283200088 687799986 905199992 88899911 206600...
output:
552023712
result:
ok "552023712"
Test #83:
score: 0
Accepted
time: 43ms
memory: 37012kb
input:
100000 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...
output:
1
result:
ok "1"
Test #84:
score: 0
Accepted
time: 43ms
memory: 36780kb
input:
100000 0 100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99...
output:
1
result:
ok "1"