QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#656354 | #7037. Distance | veg# | WA | 0ms | 3888kb | C++14 | 496b | 2024-10-19 12:34:16 | 2024-10-19 12:34:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e5+10;
ll a[maxn];
ll b[maxn];
ll c[maxn];
int main() {
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
for(int i=2;i<=n;i++) scanf("%lld",&a[i]),a[i]+=a[i-1];
for(int i=1;i<=n;i++) b[i]=b[i-1]+a[i]*i,c[i]=c[i-1]+a[i]*(n-i+1),a[i]+=a[i-1];
for(int i=1;i<=n;i++) printf("%lld ",(b[i/2]-c[n]+c[n-i/2])*2+(i+1)*(a[n]-a[n-i/2]-a[i/2]));
puts("");
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3888kb
input:
1 5 2 3 1 4
output:
0 10 20 34 48
result:
wrong answer 1st lines differ - expected: '0 10 20 34 48', found: '0 10 20 34 48 '