QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#602573#8723. 乘二UESTC_xxx#WA 0ms3800kbC++20864b2024-10-01 10:50:492024-10-01 10:50:51

Judging History

你现在查看的是最新测评结果

  • [2024-10-01 10:50:51]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3800kb
  • [2024-10-01 10:50:49]
  • 提交

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'