QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#226630#6810. Array Concatenation326173163qqom#WA 0ms3840kbC++20691b2023-10-26 11:29:472023-10-26 11:29:47

Judging History

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

  • [2023-10-26 11:29:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3840kb
  • [2023-10-26 11:29:47]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,mod=1e9+7;
int n,m,a[N];
ll lp=0,sum=0;
ll ksm(ll di,ll mi) {ll res=1; for(;mi;mi>>=1,di=di*di%mod) if(mi&1) res=res*di%mod; return res;}
int main() {
    int i,j;
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++) scanf("%d",&a[i]);
    long double la=0,lb=0,lc=n;
    for(i=1;i<m;i++) lc/=2;
    for(i=1;i<=n;i++) la+=(2*(n-i+1)-n)*(long double)(a[i]),
        (lp+=1ll*(2*(n-i+1)-n+mod)*a[i])%mod,
        lb+=a[i],(sum+=a[i])%=mod;
    if(la>lb)
        cout<<(n*ksm(2,2*m-1)%mod*sum+ksm(2,m-1)*lp)%mod;
    else
        cout<<(n*(ksm(2,2*m-1))+ksm(2,m-1))%mod*sum%mod;
    return 0;
}

详细

Test #1:

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

input:

2 1
1 2

output:

15

result:

ok single line: '15'

Test #2:

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

input:

5 10
26463 39326 86411 75307 85926

output:

806275469

result:

ok single line: '806275469'

Test #3:

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

input:

3 10000
329770536 859936159 696111818

output:

325223749

result:

ok single line: '325223749'

Test #4:

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

input:

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

output:

407766206

result:

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