QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#656354#7037. Distanceveg#WA 0ms3888kbC++14496b2024-10-19 12:34:162024-10-19 12:34:18

Judging History

This is the latest submission verdict.

  • [2024-10-19 12:34:18]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3888kb
  • [2024-10-19 12:34:16]
  • Submitted

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;
}

Details

Tip: Click on the bar to expand more detailed information

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 '