QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#637340 | #7037. Distance | Ashbourne | WA | 0ms | 3580kb | C++20 | 552b | 2024-10-13 12:15:09 | 2024-10-13 12:15:10 |
Judging History
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 '