QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#100568 | #1251. Even rain | 321625 | AC ✓ | 171ms | 144076kb | C++14 | 2.1kb | 2023-04-26 19:19:26 | 2023-04-26 19:19:30 |
Judging History
answer
#include<cstdio>
#include<cstring>
#include<algorithm>
const int N=25007,mod=1e9+7;
typedef long long ll;const ll Mod=mod,hf=(Mod+1)/2;
ll qpow(ll x,int y){ll r=1;for(;y;x=x*x%Mod,y>>=1)if(y&1)r=r*x%Mod;return r;}
void radd(int&x,int y){x=(x+y)%mod;}
int fp(ll x){return x&1?-1:1;}
int prd[26][N][26],prs[N][26],sfd[26][N][26],sfs[N][26],n,k;
int h[N];bool cmp(int x,int y){return h[x]==h[y]?x>y:h[x]>h[y];}
int fnd(int*p,int vl){return std::lower_bound(p,p+k+1,vl,cmp)-p;}
int prp[N][27],sfp[N][27];
int sol()
{
prd[0][0][0]=1;
for(int cs=0;cs<=k;++cs)
{
for(int i=1;i<=n;++i)for(int p=0;p<=k;++p)if(prd[cs][i-1][p])
{
int lp=prs[i-1][p];
if(cmp(i,lp))radd(prd[cs][i][prp[i][26]],fp((ll)h[lp]*(i-lp)+h[i])*prd[cs][i-1][p]);
else radd(prd[cs][i][prp[i][p]],fp(h[i])*prd[cs][i-1][p]);
if(cs!=k)radd(prd[cs+1][i][prp[i][p]],prd[cs][i-1][p]);
}
}
sfd[0][n+1][0]=1;
for(int cs=0;cs<=k;++cs)
{
for(int i=n;i;--i)for(int p=0;p<=k;++p)
{
int lp=sfs[i+1][p];
if(cmp(i,lp))radd(sfd[cs][i][sfp[i][26]],fp((ll)h[lp]*(lp-i)+h[i])*sfd[cs][i+1][p]);
else radd(sfd[cs][i][sfp[i][p]],fp(h[i])*sfd[cs][i+1][p]);
if(cs!=k)radd(sfd[cs+1][i][sfp[i][p]],sfd[cs][i+1][p]);
}
}
int ans=0;
for(int p=0;p<=k;++p)
{
int lp=prs[n][p],R1=fnd(prs[lp],lp),R2=fnd(sfs[lp],lp);
for(int lu=0;lu<=k;++lu)
ans=(ans+(ll)prd[lu][lp][R1]*sfd[k-lu][lp][R2])%Mod;
}
return (ans+mod)%mod;
}
int main()
{
scanf("%d%d",&n,&k);
for(int i=1;i<=n;++i)scanf("%d",h+i);
for(int i=1;i<=n;++i)
{
memcpy(prs[i],prs[i-1],sizeof*prs);
for(int j=0;j<=k;++j)prp[i][j]=j;
for(int j=0;j<=k;++j)if(cmp(i,prs[i][j]))
{
for(int z=k;z>j;--z)prs[i][z]=prs[i][z-1],prp[i][z-1]=z;
prs[i][j]=i;prp[i][26]=j;break;
}
}
for(int i=n;i;--i)
{
memcpy(sfs[i],sfs[i+1],sizeof*sfs);
for(int j=0;j<=k;++j)sfp[i][j]=j;
for(int j=0;j<=k;++j)if(cmp(i,sfs[i][j]))
{
for(int z=k;z>j;--z)sfs[i][z]=sfs[i][z-1],sfp[i][z-1]=z;
sfs[i][j]=i;sfp[i][26]=j;break;
}
}
int res=sol(),als=1;
for(int i=0;i<k;++i)als=(ll)als*(n-i)%Mod*qpow(i+1,mod-2)%Mod;
printf("%lld",(res+als)*hf%Mod);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 9748kb
input:
7 1 2 5 2 4 1 6 2
output:
4
result:
ok answer is '4'
Test #2:
score: 0
Accepted
time: 1ms
memory: 9740kb
input:
5 0 1 3 1 3 1
output:
1
result:
ok answer is '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 9724kb
input:
1 0 1
output:
1
result:
ok answer is '1'
Test #4:
score: 0
Accepted
time: 3ms
memory: 9700kb
input:
1 0 1000000000
output:
1
result:
ok answer is '1'
Test #5:
score: 0
Accepted
time: 1ms
memory: 9660kb
input:
2 0 1 1
output:
1
result:
ok answer is '1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 9736kb
input:
2 0 2 1
output:
1
result:
ok answer is '1'
Test #7:
score: 0
Accepted
time: 0ms
memory: 9720kb
input:
2 0 1 2
output:
1
result:
ok answer is '1'
Test #8:
score: 0
Accepted
time: 1ms
memory: 9668kb
input:
2 0 2 2
output:
1
result:
ok answer is '1'
Test #9:
score: 0
Accepted
time: 0ms
memory: 9708kb
input:
2 1 1 1
output:
2
result:
ok answer is '2'
Test #10:
score: 0
Accepted
time: 2ms
memory: 9736kb
input:
2 1 2 1
output:
2
result:
ok answer is '2'
Test #11:
score: 0
Accepted
time: 3ms
memory: 9700kb
input:
2 1 1 2
output:
2
result:
ok answer is '2'
Test #12:
score: 0
Accepted
time: 0ms
memory: 9672kb
input:
2 1 2 2
output:
2
result:
ok answer is '2'
Test #13:
score: 0
Accepted
time: 0ms
memory: 9676kb
input:
5 0 1 3 1 3 2
output:
1
result:
ok answer is '1'
Test #14:
score: 0
Accepted
time: 0ms
memory: 9684kb
input:
5 0 1 3 2 3 1
output:
0
result:
ok answer is '0'
Test #15:
score: 0
Accepted
time: 0ms
memory: 9724kb
input:
3 0 83 63 37
output:
1
result:
ok answer is '1'
Test #16:
score: 0
Accepted
time: 1ms
memory: 9668kb
input:
4 1 10 6 7 5
output:
1
result:
ok answer is '1'
Test #17:
score: 0
Accepted
time: 3ms
memory: 9772kb
input:
8 3 2 6 2 2 6 6 1 6
output:
32
result:
ok answer is '32'
Test #18:
score: 0
Accepted
time: 3ms
memory: 9880kb
input:
15 14 10 10 2 1 2 2 7 1 2 10 3 6 6 7 5
output:
15
result:
ok answer is '15'
Test #19:
score: 0
Accepted
time: 0ms
memory: 9716kb
input:
19 4 698682476 912592470 417653141 35102557 375001191 39323770 61586370 210301411 555112500 709882249 847903593 155155888 452517602 978122945 10306533 994365023 261387444 711757751 707985153
output:
1920
result:
ok answer is '1920'
Test #20:
score: 0
Accepted
time: 0ms
memory: 9788kb
input:
20 10 721 760 447 304 647 347 545 879 915 599 51 2 551 464 131 618 635 672 723 615
output:
92645
result:
ok answer is '92645'
Test #21:
score: 0
Accepted
time: 1ms
memory: 9692kb
input:
25 0 8 17 14 7 16 15 13 18 16 20 8 20 18 2 11 14 19 4 14 5 18 8 20 9 15
output:
0
result:
ok answer is '0'
Test #22:
score: 0
Accepted
time: 4ms
memory: 10116kb
input:
40 25 59 70 94 44 74 43 38 31 56 48 42 43 62 18 62 83 88 82 75 84 97 70 59 59 11 98 88 31 48 40 98 58 90 61 1 1 20 17 31 33
output:
112683631
result:
ok answer is '112683631'
Test #23:
score: 0
Accepted
time: 4ms
memory: 10232kb
input:
100 17 622661172 840325352 459578737 194664477 706555471 46210499 838714161 512075885 652220020 175761922 605659567 142565021 77898556 980820917 818153975 195896702 988966213 250011278 304184151 328758210 946084784 878078561 119820772 671471234 961618081 873451435 928374003 822623163 28192707 743701...
output:
639312102
result:
ok answer is '639312102'
Test #24:
score: 0
Accepted
time: 1ms
memory: 11620kb
input:
333 25 1197 488 278 837 2826 2109 658 4842 791 4702 570 3741 1630 4332 2061 145 482 3884 3922 2709 3314 3254 4148 1331 1329 343 3702 4121 3049 2959 2155 555 1851 1260 3216 2031 4312 1542 1264 1287 2404 4969 2719 651 1613 3742 2112 1996 496 4969 3520 2914 3197 2092 2728 3960 1830 1723 1870 1122 2452 ...
output:
145775141
result:
ok answer is '145775141'
Test #25:
score: 0
Accepted
time: 2ms
memory: 14984kb
input:
1532 9 523248534 145398188 754355218 478641429 259918425 783587917 628292980 706524501 545181137 614783990 544198891 238888408 411683410 618720889 350309445 766964054 556315284 138130285 692172788 751749657 290271561 37717975 448317925 233388190 550571138 120202405 285242560 544127758 178042687 1103...
output:
374699041
result:
ok answer is '374699041'
Test #26:
score: 0
Accepted
time: 11ms
memory: 20464kb
input:
4645 8 468 693 344 168 287 331 357 250 235 101 692 720 71 702 86 533 108 445 783 791 253 15 757 128 493 580 309 513 448 536 679 386 686 429 402 396 178 794 78 324 762 803 253 79 630 474 342 403 771 756 580 224 248 83 34 15 63 326 228 627 620 240 302 453 696 138 415 94 125 689 421 404 515 208 563 777...
output:
524565442
result:
ok answer is '524565442'
Test #27:
score: 0
Accepted
time: 0ms
memory: 12388kb
input:
2960 0 28406 28644 21691 13208 27158 34348 18866 1874 24361 33326 27166 20138 34610 19992 9136 31957 16765 11629 14662 13346 8160 18970 7939 8554 11082 10414 28556 30286 32211 5565 15117 4044 32576 35045 30887 6834 20465 4127 22037 31172 14046 32048 21778 16872 33105 30502 20326 14805 13589 4566 170...
output:
1
result:
ok answer is '1'
Test #28:
score: 0
Accepted
time: 114ms
memory: 112460kb
input:
19000 25 476875 873335 790472 161105 306583 934336 874176 936964 177460 229444 819745 312777 133831 451695 133899 138393 975179 259493 61106 715744 83404 950524 91484 49792 387949 594815 194662 975692 350754 579308 236672 722765 345014 406327 706348 695553 73479 126277 767619 203286 803973 869682 74...
output:
387701164
result:
ok answer is '387701164'
Test #29:
score: 0
Accepted
time: 134ms
memory: 144008kb
input:
25000 25 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
92212387
result:
ok answer is '92212387'
Test #30:
score: 0
Accepted
time: 120ms
memory: 144020kb
input:
25000 25 9 3 4 9 4 4 12 5 13 10 1 9 5 9 2 6 4 6 9 11 11 13 12 10 6 12 3 9 8 5 10 13 13 9 9 10 7 3 6 1 11 6 2 13 5 9 2 6 7 5 2 5 11 12 1 11 5 11 10 9 9 7 1 12 4 10 7 6 6 9 8 2 9 7 2 5 3 9 13 9 13 7 12 8 7 13 2 9 6 1 12 1 10 8 11 9 2 8 10 2 12 2 3 13 4 12 3 13 6 11 7 5 5 8 5 3 7 1 9 3 6 11 13 3 6 10 6...
output:
284251713
result:
ok answer is '284251713'
Test #31:
score: 0
Accepted
time: 116ms
memory: 144012kb
input:
25000 25 163 766 770 29 416 305 391 476 317 29 89 265 344 602 625 455 326 564 572 715 589 204 317 610 43 599 553 265 173 669 201 211 697 699 123 743 293 66 338 704 189 150 306 587 161 15 564 780 548 347 8 569 462 186 142 317 699 641 28 215 187 312 123 344 112 700 778 9 82 125 314 419 590 513 432 404...
output:
222215142
result:
ok answer is '222215142'
Test #32:
score: 0
Accepted
time: 114ms
memory: 143988kb
input:
25000 25 2715 1975 1279 1882 1760 1323 169 749 3710 1517 4217 3707 1762 4635 4695 4163 4049 3506 4057 3359 3924 2023 3675 1360 1834 641 2171 2786 1404 181 2623 3366 924 4122 3198 4370 2548 522 258 1643 2654 456 1079 3939 1872 333 4786 5107 1308 2336 788 2594 4364 1633 4921 929 4648 3250 4933 1831 30...
output:
20476447
result:
ok answer is '20476447'
Test #33:
score: 0
Accepted
time: 109ms
memory: 144040kb
input:
25000 25 28631 90 33857 10644 34717 10855 23177 4026 33212 30371 21503 6712 17244 38182 19540 9408 20693 14874 2860 2712 184 18113 29472 24216 2566 36781 4220 34992 14198 30918 2305 24223 10163 14024 5220 28989 3612 4674 15565 31346 31171 87 2713 7484 878 8769 6169 4334 38425 20553 7761 31083 26354 ...
output:
515720623
result:
ok answer is '515720623'
Test #34:
score: 0
Accepted
time: 129ms
memory: 144016kb
input:
25000 25 737584962 481255839 814078621 849093376 456740097 698351392 351064784 80705405 960162744 579294100 302707309 310502330 417500056 233916715 677868558 14516067 374509125 609146540 573876995 941636088 288882519 125983728 614224332 780872012 149786844 658145892 127999139 335726599 988335060 324...
output:
229105404
result:
ok answer is '229105404'
Test #35:
score: 0
Accepted
time: 131ms
memory: 138936kb
input:
24999 24 436477 793177 809062 64099 449762 748981 210032 380294 749263 140281 842031 569979 233516 957711 575223 494246 985621 929331 132173 983295 35933 814009 973485 374096 369991 525061 827525 868539 719179 335889 679927 978546 361559 138475 402843 284989 566603 223028 1338 128247 734588 586274 1...
output:
474229511
result:
ok answer is '474229511'
Test #36:
score: 0
Accepted
time: 3ms
memory: 18936kb
input:
25000 0 347956 680509 306337 222271 112985 174536 225870 93609 604683 455591 374774 101147 346837 747481 698194 744212 674818 239553 727715 448761 859877 818403 776619 773714 282322 878699 486897 355082 223522 681573 685377 45042 154803 131910 161514 813310 398118 492834 803902 280966 332576 87923 3...
output:
0
result:
ok answer is '0'
Test #37:
score: 0
Accepted
time: 10ms
memory: 22160kb
input:
25000 1 684316 246198 984521 121338 244528 336081 929181 700420 987647 592098 368579 361845 998046 463926 905642 101313 822900 38348 592979 674773 387709 745626 103125 934990 483335 814345 448216 768575 987640 380980 494746 730543 24454 412141 36653 241560 775677 186745 805495 989354 899069 470415 4...
output:
12585
result:
ok answer is '12585'
Test #38:
score: 0
Accepted
time: 8ms
memory: 37352kb
input:
25000 4 212310 8672 379203 75434 87542 722605 749511 745045 360732 127699 317290 662850 951675 973386 74481 462217 561866 691631 964581 418217 452292 882305 306834 932612 441384 331684 462987 167840 924601 768801 731364 492327 212606 930532 45047 171304 492675 76989 875680 988436 663959 617888 48979...
output:
849525539
result:
ok answer is '849525539'
Test #39:
score: 0
Accepted
time: 32ms
memory: 93236kb
input:
25000 15 714563 757445 378004 239506 128968 31040 675962 803276 275687 295256 836993 600987 585730 197144 22787 339794 931597 207422 592688 118522 586643 917693 332556 484880 786033 564477 295279 435653 452825 832406 86275 307197 524177 491481 500234 948369 869937 904135 734550 248973 942889 381847 ...
output:
309512909
result:
ok answer is '309512909'
Test #40:
score: 0
Accepted
time: 32ms
memory: 58876kb
input:
19224 11 9678 7172 10766 2300 1768 7080 7487 5986 10596 10315 7967 8856 4644 188 7469 2052 2425 5029 12779 2389 4696 2689 195 13147 3899 609 12074 1489 5327 1385 259 2769 9910 9124 12562 2896 10220 9548 2786 9700 7698 885 580 13314 12736 2800 5824 6549 9868 11940 6575 7040 9636 7146 5142 2547 6142 4...
output:
693400818
result:
ok answer is '693400818'
Test #41:
score: 0
Accepted
time: 141ms
memory: 144072kb
input:
25000 25 379116276 317630780 958815926 628970056 373643892 811281456 977346212 839148738 972621986 363969010 322652168 915055956 496507714 764528336 930117984 685076114 554370860 673332810 887382398 406556044 615741646 124824 806070796 345848896 148538028 197324326 4853764 909467684 711951832 248593...
output:
838226147
result:
ok answer is '838226147'
Test #42:
score: 0
Accepted
time: 123ms
memory: 144016kb
input:
25000 25 3051603 977014999 700191413 735995695 143010563 728719283 502921159 659321729 375765729 542283511 176943547 716396311 301481153 897731091 314554383 930860835 714798445 867948949 199175543 922211623 695654433 184440729 61262937 246369661 18677005 407499857 263778127 360674255 891993045 25284...
output:
92212387
result:
ok answer is '92212387'
Test #43:
score: 0
Accepted
time: 130ms
memory: 144020kb
input:
25000 25 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 8 8 8 8 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 ...
output:
126243894
result:
ok answer is '126243894'
Test #44:
score: 0
Accepted
time: 133ms
memory: 144012kb
input:
25000 25 23935 32472 102293 116600 185548 220646 428210 477302 523558 594425 597771 676648 692609 958127 960355 1042649 1091079 1121579 1239599 1286275 1316800 1379349 1405164 1668250 1848999 1873818 1900652 1978632 1985215 2025984 2101429 2114416 2119377 2121624 2162268 2164809 2177167 2187542 2211...
output:
649592324
result:
ok answer is '649592324'
Test #45:
score: 0
Accepted
time: 153ms
memory: 144020kb
input:
25000 25 249996 249983 249980 249969 249958 249953 249945 249928 249919 249905 249889 249876 249864 249852 249839 249830 249829 249829 249823 249783 249742 249738 249733 249732 249717 249710 249709 249677 249659 249638 249631 249610 249599 249570 249545 249537 249529 249517 249511 249505 249477 2494...
output:
626389105
result:
ok answer is '626389105'
Test #46:
score: 0
Accepted
time: 171ms
memory: 144020kb
input:
25000 25 999956837 999928470 999921017 999895738 999907089 999882393 999865567 999859407 999826283 999809620 999800326 999732640 999716309 999697459 999679913 999667330 999645785 999644925 999632191 999554710 999553906 999540266 999530159 999523818 999477455 999406414 999394625 999342865 999320168 9...
output:
673886796
result:
ok answer is '673886796'
Test #47:
score: 0
Accepted
time: 160ms
memory: 144016kb
input:
25000 25 68647058 42219140 8268524 56706192 99672230 72653208 135202828 84115365 93603202 102183648 68827496 137358916 162573603 237994311 220040751 222340180 367453056 212691891 377699776 423851000 403481568 260742378 407366029 385778208 442975864 392687701 421594997 536571716 503698943 677503942 6...
output:
965481839
result:
ok answer is '965481839'
Test #48:
score: 0
Accepted
time: 115ms
memory: 144024kb
input:
25000 25 206 228 1829 750 2176 3840 2819 4422 9295 5499 10220 10575 8167 11010 14532 12167 15206 15346 16927 15746 17144 18697 17862 17361 19963 23247 20593 23467 23824 26084 26562 26945 27295 27077 28186 29740 29850 29041 30580 31526 33464 34973 34068 35439 35561 35779 36770 36888 37283 36808 39389...
output:
185811720
result:
ok answer is '185811720'
Test #49:
score: 0
Accepted
time: 119ms
memory: 143984kb
input:
25000 25 25000 24999 24999 24998 24998 24997 24997 24997 24996 24996 24995 24988 24995 24988 24988 24984 24986 24981 24981 24981 24980 24980 24980 24979 24977 24976 24973 24975 24978 24973 24972 24970 24972 24969 24964 24969 24964 24964 24962 24964 24961 24959 24958 24959 24956 24955 24958 24957 249...
output:
305606949
result:
ok answer is '305606949'
Test #50:
score: 0
Accepted
time: 105ms
memory: 144012kb
input:
25000 25 379149451 620741117 687402226 854306744 760008406 858121327 640499096 171357583 117463268 949565726 430795611 466318590 751405425 846748274 463038103 567410145 762541211 523754714 470807887 203092568 1844841 260751174 159541161 86853444 921151297 93690795 841494128 460763854 511307887 74464...
output:
111126788
result:
ok answer is '111126788'
Test #51:
score: 0
Accepted
time: 119ms
memory: 144036kb
input:
25000 25 206793 227924 241446 293935 416938 531023 808978 952525 957308 960136 1060700 1246562 1296182 1320774 1398411 1545326 1579030 1605440 1861038 1869750 1982661 2331005 2349316 2609022 2749557 2890433 2942830 2950096 2977626 2983648 3162547 3248185 3350722 3450438 3584215 3603034 3749532 38373...
output:
61522593
result:
ok answer is '61522593'
Test #52:
score: 0
Accepted
time: 139ms
memory: 144028kb
input:
25000 25 14618809 775645317 273046073 107820010 437642146 424727889 414233447 351723687 65061219 719095777 81411097 317506747 544051012 365486188 980505270 81346366 385043996 299290659 971321190 137528874 577714903 715777102 548340199 722140783 332473248 994295666 43273703 961113425 552485584 633736...
output:
588348777
result:
ok answer is '588348777'
Test #53:
score: 0
Accepted
time: 136ms
memory: 144048kb
input:
25000 25 999999999 999999999 999999999 999999999 999999999 999977240 999923438 999914815 999901796 999849116 999807705 999789648 999656254 999638194 999619195 999521211 999500811 999491153 999415922 999363607 999329969 999329536 999319109 999122624 999087269 999046642 998995604 998982273 998892295 9...
output:
493040148
result:
ok answer is '493040148'
Test #54:
score: 0
Accepted
time: 121ms
memory: 144016kb
input:
25000 25 169458570 591375867 434171181 768368505 953009085 32621824 714187266 339548933 944859468 378943782 176840322 805644634 8120441 94730857 998968201 974256031 567680606 713509820 140832267 499639598 769284452 347852673 578481548 822243862 12632524 800316946 143728806 622349209 672331817 549350...
output:
656373393
result:
ok answer is '656373393'
Test #55:
score: 0
Accepted
time: 127ms
memory: 144020kb
input:
25000 25 9 11 21 28 29 49 52 56 61 73 78 88 113 124 135 143 145 156 158 158 166 170 170 191 203 229 231 241 253 271 279 281 283 284 302 309 318 340 352 353 360 368 385 387 399 399 403 413 417 419 426 433 434 435 448 454 455 456 471 479 480 484 485 487 488 522 522 530 530 545 550 557 564 584 586 593 ...
output:
765151958
result:
ok answer is '765151958'
Test #56:
score: 0
Accepted
time: 116ms
memory: 144016kb
input:
25000 25 493033503 829254461 655918507 99042227 480033048 224455918 888705978 476300260 3315121 747909481 744427865 781461188 806351878 577926527 803935729 755509886 964193132 543710290 670145885 501780686 84370153 435183579 75017327 854900104 253231543 349920613 223996779 765117200 980570053 623428...
output:
937670511
result:
ok answer is '937670511'
Test #57:
score: 0
Accepted
time: 134ms
memory: 144016kb
input:
25000 25 161755 254346 364319 467229 521996 544448 600710 833380 838915 859829 935606 1171211 1217712 1763126 1780341 1829469 1831228 2014974 2016993 2185418 2235399 2237520 2349918 2502957 2548439 2644171 2681047 2825371 2840782 2847513 2934890 2954991 3044815 3078347 3263769 3377093 3510456 357099...
output:
399162513
result:
ok answer is '399162513'
Test #58:
score: 0
Accepted
time: 111ms
memory: 144012kb
input:
25000 25 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 9...
output:
381326858
result:
ok answer is '381326858'
Test #59:
score: 0
Accepted
time: 128ms
memory: 144044kb
input:
25000 25 126656450 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 9...
output:
456899289
result:
ok answer is '456899289'
Test #60:
score: 0
Accepted
time: 112ms
memory: 143984kb
input:
25000 25 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000...
output:
838226147
result:
ok answer is '838226147'
Test #61:
score: 0
Accepted
time: 139ms
memory: 144000kb
input:
25000 25 1000000000 563077626 399448787 746686432 349584566 580869545 838956252 95206270 566319908 16599397 650920470 182004454 454045476 129145585 405864754 102932990 754766168 264201333 914129382 709287761 364940712 967257343 647417706 477280395 813084606 866960638 622947068 947095809 371862409 98...
output:
82450469
result:
ok answer is '82450469'
Test #62:
score: 0
Accepted
time: 128ms
memory: 144000kb
input:
25000 25 999996 940127 435048 389994 527825 523994 432537 874778 201494 38861 32834 659701 831810 38296 476900 295776 447720 912387 810113 287203 438940 936118 431393 239913 636984 374465 335246 713923 484504 568918 777367 905382 802014 934986 173073 23208 564718 861912 269969 342599 171891 835805 1...
output:
865861569
result:
ok answer is '865861569'
Test #63:
score: 0
Accepted
time: 109ms
memory: 144032kb
input:
25000 25 1000000000 1000000000 999999999 999999999 999999999 999999999 999999999 999999996 999999997 999999999 1000000000 999999996 127998183 733483136 530559019 902612042 160575776 60632460 914948150 127146167 179943825 976877796 447119684 215840552 793024702 74033451 999026052 651946235 579690272 ...
output:
264466891
result:
ok answer is '264466891'
Test #64:
score: 0
Accepted
time: 94ms
memory: 144024kb
input:
25000 25 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 86402939 14637766 77517164 61840793 85187803 35230746 17167511 10785142 633...
output:
31613536
result:
ok answer is '31613536'
Test #65:
score: 0
Accepted
time: 161ms
memory: 144028kb
input:
25000 25 999999998 999999999 999999997 999999996 1000000000 999999998 999999996 999999999 999999997 999999996 1000000000 999999996 999999999 999999996 999999998 999999996 1000000000 999999998 999999997 999999996 999999998 999999999 1000000000 999999998 999999999 1000000000 986867935 833021858 773844...
output:
71812117
result:
ok answer is '71812117'
Test #66:
score: 0
Accepted
time: 104ms
memory: 144076kb
input:
25000 25 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:
53661946
result:
ok answer is '53661946'
Test #67:
score: 0
Accepted
time: 132ms
memory: 144044kb
input:
25000 25 7 4 6 1 4 20 13 19 13 21 20 20 21 22 21 39 37 38 35 35 41 35 49 51 52 45 50 59 58 58 68 66 69 67 68 81 82 91 91 93 91 93 91 99 102 100 111 110 112 115 112 114 127 127 128 125 122 133 132 142 137 139 139 141 150 149 154 148 150 152 154 162 156 159 158 158 160 161 168 169 170 167 184 184 185 ...
output:
125796557
result:
ok answer is '125796557'
Test #68:
score: 0
Accepted
time: 145ms
memory: 144020kb
input:
25000 25 4 7 8 5 6 8 7 1 2 2 9 9 9 28 30 30 25 29 32 32 24 25 26 26 25 24 27 54 58 58 59 61 54 56 61 54 59 60 58 57 78 92 87 90 80 92 86 82 91 87 104 111 105 104 110 126 122 124 128 125 123 128 120 120 127 128 123 119 151 149 152 147 150 147 146 154 154 178 181 183 171 177 174 183 177 172 181 191 19...
output:
433458249
result:
ok answer is '433458249'