QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#790909#7037. Distancesurenjamts#Compile Error//Python3552b2024-11-28 15:59:052024-11-28 15:59:09

Judging History

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

  • [2024-11-28 15:59:09]
  • 评测
  • [2024-11-28 15:59:05]
  • 提交

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

  File "answer.code", line 2
    using namespace std;
          ^^^^^^^^^
SyntaxError: invalid syntax