QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#790909 | #7037. Distance | surenjamts# | Compile Error | / | / | Python3 | 552b | 2024-11-28 15:59:05 | 2024-11-28 15:59:09 |
Judging History
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