QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#790913#7037. Distancesurenjamts#WA 0ms3640kbC++23552b2024-11-28 15:59:462024-11-28 15:59:50

Judging History

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

  • [2024-11-28 15:59:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3640kb
  • [2024-11-28 15:59:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[100045], e;
void solve(){
	int n;
	cin>>n;
	int lst = 0;
	a[1] = 0;
	for(int i=2; i<=n; i++){
		cin>>e;
		a[i] = a[i-1] + e;	
	}
	vector < int > vc;
	int sum = 0, ans = 0;
	int l = 1, r = n;
	for(int i = 1; i <= n; i ++ ){
		if( i % 2 == 1 ){
			ans += sum;
			
		}else{
			ans += sum;
			sum += a[r]-a[l];
			ans += a[r] - a[l];
			r--, l ++;
		}
		cout << ans << " ";
	}
	cout << "\n";
}
signed main(){
	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: 3640kb

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 '