QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#637429 | #7037. Distance | Ashbourne | WA | 96ms | 5224kb | C++20 | 530b | 2024-10-13 12:47:36 | 2024-10-13 12:47:37 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int T;
int a[100010],sum[100010];
void solve(){
int n;
cin >> n;
for(int i = 1; i <= n - 1; ++ i)
{
cin >> a[i];
sum[i] = sum[i - 1] + a[i];
}
int t = 0, ans = 0;
for(int i = 1; i <= n; ++ i){
if(i % 2 == 0){
t += abs(sum[n-i/2]-sum[i/2-1]);
}
ans += t;
if(i != n)
cout << ans << " ";
else cout << ans;
}
if(T != 1) cout << endl;
}
signed main(){
ios::sync_with_stdio(0);
cin >> T;
while(T--) solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3672kb
input:
1 5 2 3 1 4
output:
0 10 20 34 48
result:
ok single line: '0 10 20 34 48'
Test #2:
score: -100
Wrong Answer
time: 96ms
memory: 5224kb
input:
1000 9 2923 3524 6268 567 2776 5657 3707 919 4 833 4391 7520 5 1195 8820 9988 1997 8 720 2558 3179 2776 4346 6770 10000 4 9384 5417 1899 10 9426 918 7162 3418 711 830 51 5913 765 8 10000 5011 5601 6629 5743 822 2610 10 7390 6502 5200 6750 3128 5391 3276 1281 1973 8 9218 9883 7924 2515 3582 3101 1173...
output:
0 26341 52682 101522 150362 214470 278578 346029 413480 0 12744 25488 42623 0 22000 44000 84808 125616 0 30349 60698 110676 160654 220933 281212 344267 0 16700 33400 55517 0 29194 58388 106585 154782 215151 275520 340848 406176 472215 0 36416 72832 133054 193276 271471 349666 434490 0 40891 81782 15...
result:
wrong answer 999th lines differ - expected: '0 462030695 924061390 18481106...998384274502 659002672762478173', found: '0 462030695 924061390 18481106...965955233686 630713334450352010'