QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#659704#6810. Array ConcatenationqkyWA 1ms3684kbC++17752b2024-10-19 21:25:582024-10-19 21:26:03

Judging History

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

  • [2024-10-19 21:26:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3684kb
  • [2024-10-19 21:25:58]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
int n,m;
const int N=1e5+5;
int a[N];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m;
	ll ab=0,ba=0,sum=0;
	for(int i=1;i<=n;i++) {cin>>a[i];
	sum+=a[i];sum%=mod;
	ab+=i*a[i];ab%=mod;
	ba+=(n-i+1)*a[i];ba%=mod;
	}
	//cout<<ab<<" "<<ba<<" "<<sum<<endl;
	ll ans=0,ans1=0,ans2=0;
	ll shu=1;
	for(int i=1;i<=m;i++){
		if(i==m) {
			ans1=((ab+ba)%mod*shu)%mod;
			ans=sum*shu%mod;
		}
		shu*=2;
		shu%=mod;
		if(i==m) {
			ans=(ans*(shu-1))%mod;
		}
	}
	ans=(ans*n)%mod;
	ans2=(ba*shu)%mod;
	//cout<<ans<<" "<<ans1<<" "<<ans2<<endl;
	ans1=(ans+ans1)%mod;
	ans2=(ans2+ans)%mod;
	cout<<max(ans1,ans2)<<endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1
1 2

output:

15

result:

ok single line: '15'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

5 10
26463 39326 86411 75307 85926

output:

806275469

result:

ok single line: '806275469'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

3 10000
329770536 859936159 696111818

output:

325223749

result:

ok single line: '325223749'

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3680kb

input:

10 100000
910385778 832405357 79882277 740539785 58009121 361679935 208356273 191444931 327043571 40502864

output:

856552494

result:

wrong answer 1st lines differ - expected: '551220212', found: '856552494'