QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#739632 | #6810. Array Concatenation | caiwen | AC ✓ | 8ms | 4732kb | C++14 | 904b | 2024-11-12 22:30:23 | 2024-11-12 22:30:24 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
const long long mod = 1e9+7;
long long a[N],prefixsum,reprefixsum,sum,f;
long long qpow(long long base,long long times){
long long tot = 1;
while(times){
if(times & 1) tot = tot * base % mod;
base = base * base % mod;
times >>= 1;
}
return tot % mod;
}
int main(){
int n,m;
scanf("%d %d",&n,&m);
for(int i = 1;i <= n;++ i){
scanf("%d",&a[i]);
prefixsum = (prefixsum + a[i] * (n - i + 1)) % mod;
reprefixsum = (reprefixsum + a[i] * i) % mod;
sum = (sum + a[i]) % mod;
}
long long s = qpow(2,m) - 1,f = (s + 1) * s / 2 % mod;
long long base = f * n % mod * sum % mod;
long long d = qpow(2,m - 1);
long long use1 = (base + d * prefixsum % mod + d * reprefixsum % mod ) % mod;
long long use2 = (base + d * 2 * prefixsum % mod) % mod;
printf("%lld",max(use1,use2));
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3764kb
input:
2 1 1 2
output:
15
result:
ok single line: '15'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
5 10 26463 39326 86411 75307 85926
output:
806275469
result:
ok single line: '806275469'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
3 10000 329770536 859936159 696111818
output:
325223749
result:
ok single line: '325223749'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
10 100000 910385778 832405357 79882277 740539785 58009121 361679935 208356273 191444931 327043571 40502864
output:
551220212
result:
ok single line: '551220212'
Test #5:
score: 0
Accepted
time: 8ms
memory: 4732kb
input:
99998 99999 424541359 970848132 124944765 190568793 218987145 439687684 674898132 26756266 495705287 999481800 123311748 808192729 480063991 282558300 432664601 480692564 771223766 592954167 648647039 80490877 501738111 3075724 426165921 557518328 209501102 786985447 129062653 705971029 763019010 16...
output:
371554090
result:
ok single line: '371554090'
Test #6:
score: 0
Accepted
time: 2ms
memory: 4096kb
input:
23854 89381 394875321 358990454 858102462 384724857 275727903 97926601 474697159 911286664 206848005 33299065 794156923 141542667 429367570 397169821 74508725 520716485 677478792 133016266 58719731 925502886 956794304 194692492 985435726 883349224 42102293 676396529 839744928 366681778 656265608 115...
output:
426677952
result:
ok single line: '426677952'
Test #7:
score: 0
Accepted
time: 6ms
memory: 4560kb
input:
83492 48249 70494500 885620970 315369497 739608603 637096477 10395600 246855095 506270453 443170180 577100499 577449412 138165292 246928155 689186056 498722336 790825887 594302101 414730621 572006760 546794452 98888789 727318449 857676435 114468371 676126291 935100863 178502984 187768465 696814401 6...
output:
510020598
result:
ok single line: '510020598'
Test #8:
score: 0
Accepted
time: 8ms
memory: 4688kb
input:
99824 43532 774340602 936278614 964709803 488385916 459911693 6573867 299867606 777690440 87564223 407397293 234189335 321895358 125495230 145168763 182375587 226125349 301825885 840410768 846358234 257084607 187826907 26856116 65896632 752477170 556078517 496528163 816563279 928793952 38603811 8858...
output:
263266590
result:
ok single line: '263266590'
Test #9:
score: 0
Accepted
time: 8ms
memory: 4692kb
input:
100000 40 735211086 438848581 883369263 411520254 96701572 639546923 41849752 603158600 721918949 2491206 846495417 323507652 718479900 610177876 169869700 545169629 512881910 798460780 380319407 851809813 556619434 326106153 766145881 413339664 941433832 816866760 79378460 799224104 568687839 84804...
output:
306284744
result:
ok single line: '306284744'
Test #10:
score: 0
Accepted
time: 2ms
memory: 4076kb
input:
23953 45 683748821 612750772 108955188 189347284 174144841 250179431 120191050 187634530 898576451 1441271 217512380 387893431 760563896 916276840 842158620 535523458 489365029 906291096 981459100 951030954 591286713 941916980 356586968 21930783 331322685 685554526 28530069 283919592 923287457 58260...
output:
684353541
result:
ok single line: '684353541'
Test #11:
score: 0
Accepted
time: 7ms
memory: 4564kb
input:
93832 42 908188181 165511955 890835963 117801748 989107964 673319227 339523561 57309413 674275233 566312538 881454252 198011507 599370073 737838593 828075676 924662932 571389601 375627808 991011835 517168201 209645447 674183464 717857602 480064591 248569662 238636694 890903229 490314005 766459974 82...
output:
948691303
result:
ok single line: '948691303'
Test #12:
score: 0
Accepted
time: 7ms
memory: 4620kb
input:
84848 57 838266134 623917219 258643 129066071 808466446 903832220 797947975 947145019 824865217 864348221 99390241 382266782 728809185 265546081 912492507 606412181 394978022 742858736 724770123 225544196 475157471 248657353 123652713 659979055 61326376 112241740 959091099 306895952 519410863 908018...
output:
903871741
result:
ok single line: '903871741'
Test #13:
score: 0
Accepted
time: 3ms
memory: 4068kb
input:
28945 43 352287352 503010224 636821064 285972761 637824265 776596877 462767185 554623594 286079641 440477179 133693956 101913521 171066441 758018628 973969771 817405556 153175004 722147178 132130370 131087230 88704395 813550985 435425260 408366447 435176344 614737743 180148825 382903647 384527447 90...
output:
313164680
result:
ok single line: '313164680'
Test #14:
score: 0
Accepted
time: 5ms
memory: 4216kb
input:
64824 41 548047686 999205693 733501472 796998368 500687679 663337813 59367418 259908095 532255091 703142235 851866596 236173934 912880555 340520639 137652118 517051018 537982727 166573580 827478604 92671019 233735541 111546528 319045591 997692461 229806248 113019668 670491201 427252028 708881324 390...
output:
996498571
result:
ok single line: '996498571'
Test #15:
score: 0
Accepted
time: 4ms
memory: 4288kb
input:
48293 52 26779511 340658355 468026871 807214516 521155343 610357622 655886189 314733874 164399901 464979295 429216293 636887948 66650159 314831754 45000380 926807254 867524622 944333666 375097853 311417209 753113775 622415676 59665415 13246057 861974802 458490860 954510370 688141940 727901965 297679...
output:
185065235
result:
ok single line: '185065235'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
10 51 914212796 182028761 562087890 276214390 713135259 783442230 798097444 162392724 749572620 191887044
output:
623728480
result:
ok single line: '623728480'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
200 51 194174615 9627301 308394566 848823877 735445618 120756110 76110125 438431588 874511496 24283776 816231652 849830265 154684296 861483254 739783308 146463944 521832788 134212176 543390879 588613835 467413116 95136969 540772099 922893871 948552948 387364076 44373647 97381144 233980733 323207755 ...
output:
636033935
result:
ok single line: '636033935'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
42 51 292379432 24263785 916067093 66998235 23238405 752668205 111198179 892430735 881238070 3871344 457611968 392706959 555072521 391162936 367978210 155371342 189214457 333479954 808800077 635949890 257331871 361654655 732827818 899422651 834445953 704878442 976200344 630791922 527108019 714559489...
output:
445954262
result:
ok single line: '445954262'