QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#659700 | #6810. Array Concatenation | qky | WA | 0ms | 3568kb | C++17 | 748b | 2024-10-19 21:24:29 | 2024-10-19 21:24:30 |
Judging History
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;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3568kb
input:
2 1 1 2
output:
5 4 3 6 9 8 15
result:
wrong answer 1st lines differ - expected: '15', found: '5 4 3'