QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#602544#8723. 乘二UESTC_Snow_Halation#WA 35ms7296kbC++14849b2024-10-01 10:31:162024-10-01 10:31:17

Judging History

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

  • [2024-10-01 10:31:17]
  • 评测
  • 测评结果:WA
  • 用时:35ms
  • 内存:7296kb
  • [2024-10-01 10:31:16]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long

using namespace std;
const ll N=801010;
const ll p=1000000007;

ll n,K;
ll a[N],b[N];
priority_queue <ll, vector <ll>, greater<ll> > q;

int main() {
	scanf("%lld%lld",&n,&K);
	ll ans = 0, sum = 1000;
	for(ll i=1;i<=n;i++) {
		scanf("%lld",&a[i]);
		q.push(a[i]);
	}
	if(sum>=K) {
		while(K--) {
			ll u = q.top(); q.pop();
			u = u*2 %p;
			q.push(u);
		}
		while(!q.empty()) {
			(ans += q.top()) %= p; q.pop();
		}
		cout<<ans;
		return 0;
	}
	ll qian = sum;
	ll ci = (K-sum) / n;
	ll mi = 1;
	while(ci--) mi = mi * 2 %p;
	qian += (K-sum) % n;
	while(qian--) {
		ll u = q.top(); q.pop();
		u = u*2 %p;
		q.push(u);
	}
	while(!q.empty()) {
		ll u = q.top(); q.pop();
		(ans += u * mi %p) %= p;
	}
	cout<<(ans%p+p)%p;
	return 0;
}

/*

3 10
1

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5796kb

input:

3 3
7 2 1

output:

15

result:

ok 1 number(s): "15"

Test #2:

score: -100
Wrong Answer
time: 35ms
memory: 7296kb

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:

695648891

result:

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