QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#738097#6810. Array ConcatenationcaiwenWA 0ms1584kbC++14742b2024-11-12 17:42:522024-11-12 17:42:53

Judging History

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

  • [2024-11-12 17:42:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1584kb
  • [2024-11-12 17:42:52]
  • 提交

answer

#include<cstdio>
using namespace std;
const long long M=1e9+7;
int main()
{
	long long n,m,x=0,y=0,g=0;
	scanf("%Ld%Ld",&n,&m);
	for(long long i=1;i<=n;i++)
	{
		long long a;
		scanf("%Ld",&a);
		x+=a*i;
		y+=a*(n-i+1);
		g+=a;
		x%=M;
		y%=M;
		g%=M;
	}
	if(y>=x)
	{
		long long h=0,pw=1;
		for(long long i=1;i<=m;i++)
		{
			pw*=2;
			pw%=M;
		}
		h+=y*pw;
		h%=M;
		long long p=pw*(pw-1)/2,q=n*g;
		p%=M;
		q%=M;
		h+=p*q;
		h%=M;
		printf("%Ld",h);
	}
	else
	{
		long long h=0,pw=1;
		for(long long i=1;i<m;i++)
		{
			pw*=2;
			pw%=M;
		}
		h+=y*pw+x*pw;
		h%=M;
		pw*=2;
		pw%=M;
		long long p=pw*(pw-1)/2,q=n*g;
		p%=M;
		q%=M;
		h+=p*q;
		h%=M;
		printf("%Ld",h);
	}
	return 0;
}

详细

Test #1:

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

input:

2 1
1 2

output:

15

result:

ok single line: '15'

Test #2:

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

input:

5 10
26463 39326 86411 75307 85926

output:

806275469

result:

ok single line: '806275469'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 1584kb

input:

3 10000
329770536 859936159 696111818

output:

9530648

result:

wrong answer 1st lines differ - expected: '325223749', found: '9530648'