QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#637340#7037. DistanceAshbourneWA 0ms3580kbC++20552b2024-10-13 12:15:092024-10-13 12:15:10

Judging History

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

  • [2024-10-13 12:15:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2024-10-13 12:15:09]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
	int n;
	cin >> n;
	vector<int> a(n + 1), sum(n + 1);
	for(int i = 1; i <= n - 1; ++ i){
		cin >> a[i]; sum[i] = sum[i - 1] + a[i];
	}
	int xx = 0, ans = 0;
	for(int i = 1; i <= n; ++ i){
		if((i & 1) == 0){
			int t = i / 2; t--;
			xx += sum[n - 1 - t] - sum[t];
		}
		ans += xx;
		if(i != n - 1)
		cout << ans << " ";
		else cout << ans;
	}
	cout << endl;
}
signed main(){
	ios::sync_with_stdio(0);
	int T;
	cin >> T;
	while(T--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3580kb

input:

1
5
2 3 1 4

output:

0 10 20 3448 

result:

wrong answer 1st lines differ - expected: '0 10 20 34 48', found: '0 10 20 3448 '