QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#740351 | #8723. 乘二 | ucup-team4352# | AC ✓ | 320ms | 5352kb | C++23 | 749b | 2024-11-13 09:17:09 | 2024-11-13 09:17:10 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2e5+5,p=1e9+7;
ll qpow(ll x,ll y){
ll s=1;
while(y){
if(y&1)s=s*x%p;
x=x*x%p;
y>>=1;
}
return s;
}
ll a[maxn];
void solve(){
int n,k;
cin>>n>>k;
priority_queue<ll,vector<ll>,greater<ll>>q;
int t=0;
for(int i=1;i<=n;i++){
int x;
cin>>x;
q.push(x);
t=max(t,x);
}
while(k>0&&(k%n||q.top()*2<t)){
k--;
ll now=q.top();
q.pop();
q.push(now*2);
}
ll tmp=qpow(2,k/n);
ll ans=0;
for(int i=1;i<=n;i++){
ll x=q.top();
q.pop();
ans+=x%p*tmp%p;
if(ans>=p)ans-=p;
}
cout<<ans<<"\n";
}
int main(){
ios::sync_with_stdio(0),cin.tie(0);
int t=1;
// cin>>t;
while(t--)solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
input:
3 3 7 2 1
output:
15
result:
ok 1 number(s): "15"
Test #2:
score: 0
Accepted
time: 156ms
memory: 5180kb
input:
200000 1605067 366760624 67854 93901 693975 27016 1046 10808 6533158 54778 500941023 77236442 32173 10431454 2 9726 1553148 89282 411182309 494073 131299543 249904771 7906930 353 9909 3632698 29156 1917186 303 737 1189004 22 1983 263 711 4106258 2070 36704 12524642 5192 123 2061 22887 66 380 1 10153...
output:
707034173
result:
ok 1 number(s): "707034173"
Test #3:
score: 0
Accepted
time: 39ms
memory: 5352kb
input:
200000 108039 13 851590697 3104 109395313 37 928 2329004 13853269 1 15 226 4785 488 2930 83250294 12228 145352832 120690 14511669 181 10740 26395301 4 1172 451394571 24571 11076 90419 5929 579583498 903729755 142027966 300157 25 20 22148 30321289 71577040 37091 1951 445549 21 96460 3491 624 764 1 48...
output:
752908968
result:
ok 1 number(s): "752908968"
Test #4:
score: 0
Accepted
time: 280ms
memory: 5348kb
input:
200000 2903290 201855332 123438 83762 1638319 17 122361 121973 17172 44 51 1 5 367822770 251 1908405 5 240290 185972 303017248 22227 193978 133159 92105 504 227 4796 1173 143 6 67736 252033016 257 876 845 16 39 9408 18 204865935 18263757 564396 213 126820 23050809 235107 1025 2169 7495 1264417 1 158...
output:
832633511
result:
ok 1 number(s): "832633511"
Test #5:
score: 0
Accepted
time: 280ms
memory: 5192kb
input:
200000 2896585 6 452 3906 198 2255433 1 801262 36414 814625805 15306728 1 323 9147 38 209 27 65213 52955210 1058270 212337 33487357 748 1192540 5474 45771272 953357 49527 59 76 12 58289305 2981 51095 235 109 14245387 460771 804 77441813 518 13278099 1032654 2 97035 13 1290 488716758 926 771025363 13...
output:
675173351
result:
ok 1 number(s): "675173351"
Test #6:
score: 0
Accepted
time: 279ms
memory: 5352kb
input:
200000 2903371 3753 232038 1596 27188889 29806557 4507 101382910 29719929 5846 126677 26420576 129855 3056030 2888725 4010747 4 12420 20002 24 237 253986 15720 2 1408 210143934 115978 457371 130799 370 6526734 11 12314003 12801660 157231514 115822 256104005 741129 3 1177403 33905648 17 125368170 232...
output:
682045332
result:
ok 1 number(s): "682045332"
Test #7:
score: 0
Accepted
time: 143ms
memory: 5272kb
input:
200000 1379432 217058486 3 323 10 162481 57177214 1678053 1 102 344174298 43456176 29791 26831 1163 2052378 38165 257 543 3078 20 155606738 371718950 2206343 91109757 52819894 226780639 1449 324614092 1 5156380 25135511 2 703379984 284865307 18 54995975 9 264 16066939 1 344513 386945818 23384664 138...
output:
724985989
result:
ok 1 number(s): "724985989"
Test #8:
score: 0
Accepted
time: 179ms
memory: 5232kb
input:
200000 1766925 435446 1 933 69620787 614953807 7697 553 166794 37 852 1838 282 131157201 91 5012 83045 53 471328 3 915357 7 1 791554250 6 237448 3688 15020 30076 2088 7 133877 5448 488942367 472 113 128774175 74422376 294698 453085 116 149183429 72768 138 66470849 129266201 4 716757134 77 2405 19168...
output:
517037208
result:
ok 1 number(s): "517037208"
Test #9:
score: 0
Accepted
time: 292ms
memory: 5168kb
input:
200000 688425072 2541 13648574 164117 7494942 2212249 200 1722 466007 43596 25893922 283753 637416551 81907530 15 1006457 1409 11096782 1 16 2240287 55407492 2377695 944 120 776859 890171856 6138 109 915 31958 95467702 922635 120 189 3 339 549450930 151077 10 3814 890391326 6509774 26584150 4560323 ...
output:
161069543
result:
ok 1 number(s): "161069543"
Test #10:
score: 0
Accepted
time: 274ms
memory: 5280kb
input:
200000 998927851 447404 375 1 259249 15 738452 14 48482 15786 159 5294 41 166 43506 594 5592115 2 10305 25591700 477288526 9849308 101 68 2545523 5930 3498 9467615 112241959 14 25057570 43765 943942 983 232 891982 86 52759548 32501 25855886 117 154417 15902 6 4722165 16 2 654438107 13308556 776 4321...
output:
489247406
result:
ok 1 number(s): "489247406"
Test #11:
score: 0
Accepted
time: 320ms
memory: 5264kb
input:
200000 1000000000 1000000000 175218 140993 186142 145504 175438 125343 47317 113162 172675 88894 166738 69275 88430 94792 78387 168170 176008 34542 105370 196430 143111 126048 129039 138331 50740 14940 126372 111378 165735 146845 177624 142741 132881 175406 148763 151038 107424 176573 26272 189812 6...
output:
22305951
result:
ok 1 number(s): "22305951"
Extra Test:
score: 0
Extra Test Passed