QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#790913 | #7037. Distance | surenjamts# | WA | 0ms | 3640kb | C++23 | 552b | 2024-11-28 15:59:46 | 2024-11-28 15:59:50 |
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
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 '