QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#415719#8723. 乘二ANIG#WA 139ms10736kbC++14832b2024-05-21 09:07:212024-05-21 09:07:21

Judging History

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

  • [2024-05-21 09:07:21]
  • 评测
  • 测评结果:WA
  • 用时:139ms
  • 内存:10736kb
  • [2024-05-21 09:07:21]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+5,mods=1e9+7;
int p[N],n,k;
double g[N];
struct node{
	int bh;double sm;
	friend bool operator<(node a,node b){
		return a.sm>b.sm;
	}
};
priority_queue<node>q;
int pows(int a,int b){
	if(b==0)return 1;
	int res=pows(a,b>>1);
	res=res*res%mods;
	if(b&1)res=res*a%mods;
	return res;
}
signed main(){
	cin>>n>>k;
	int res=0;
	for(int i=1;i<=n;i++)cin>>p[i],g[i]=log2(p[i]),q.push({i,g[i]}),res+=p[i];
	int cnt=0;
	while(k--){
		cnt++;
		if(cnt>1000000){
			int t=k/n;
			k-=t*n;
			for(int i=1;i<=n;i++)res+=(pows(2,t)-1)*p[i],res%=mods,p[i]=p[i]*pows(2,t)%mods;
		    cnt=-1e18;
		}
		int x=q.top().bh;
		q.pop();
		g[x]+=1;
		q.push({x,g[x]});
		res+=p[x];
		p[x]=p[x]*2%mods;
		res%=mods;
	}
	cout<<res;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3704kb

input:

3 3
7 2 1

output:

15

result:

ok 1 number(s): "15"

Test #2:

score: -100
Wrong Answer
time: 139ms
memory: 10736kb

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:

262719313

result:

wrong answer 1st numbers differ - expected: '707034173', found: '262719313'