QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#602573 | #8723. 乘二 | UESTC_xxx# | WA | 0ms | 3800kb | C++20 | 864b | 2024-10-01 10:50:49 | 2024-10-01 10:50:51 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#define ll long long
using namespace std;
int n;
ll k,a[500005],ans,mod=1e9+7;
priority_queue<ll,vector<ll>,greater<ll> >q;
ll Pow(ll x,ll y){
ll z=1;
while(y){
if(y&1) z=(x*z)%mod;
x=x*x%mod;
y>>=1;
}
return z;
}
int main(){
scanf("%d%lld",&n,&k);
for(int i=1;i<=n;++i) scanf("%lld",&a[i]),q.push(a[i]);
sort(a+1,a+n+1);
while(q.top()!=a[n]){
ll x=q.top();
q.pop();
x=x*2;
q.push(x);
k--;
if(!k) break;
}
for(int i=1;i<=n;++i){
ll x=q.top();
a[i]=x%mod;
q.pop();
}
ll y=k/n,z=(k-1+n)%n+1;
for(int i=1;i<=z;++i){
ans+=a[i]*Pow(2,y+1)%mod;
ans%=mod;
}
for(int i=z+1;i<=n;++i){
ans=(ans+a[i]*Pow(2,y)%mod)%mod;
}
printf("%lld",ans);
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3800kb
input:
3 3 7 2 1
output:
30
result:
wrong answer 1st numbers differ - expected: '15', found: '30'