QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#656354#7037. Distanceveg#WA 0ms3888kbC++14496b2024-10-19 12:34:162024-10-19 12:34:18

Judging History

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

  • [2024-10-19 12:34:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3888kb
  • [2024-10-19 12:34:16]
  • 提交

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 '