QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#188772 | #7037. Distance | zwp1234 | WA | 1ms | 3388kb | C++17 | 2.0kb | 2023-09-26 13:54:13 | 2023-09-26 13:54:13 |
Judging History
answer
//# pragma GCC optimize(2)
#include <bits/stdc++.h>
#define int long long
#define SZ(x) (int)(x).size()
#define fs first
#define sc second
#define PII pair<int,int>
#define ls(u) (u)<<1
#define rs(u) (u)<<1|1
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vi >
#define vI vector<PII>
#define db double
#define all(a) (a).begin(),(a).end()
#define die cout << "???" << endl
//#define endl '\n'
using namespace std;
const int mod = 998244353;
//const int mod = 1169996969;
//const int mod = 1e9+7;
//const int inf = LLONG_MAX;
const int inf = 0x3f3f3f3f;
//const int inf = 1e9;
//const db PI = acos(-1.0);
const db eps = 1e-5;
typedef long long ll;
typedef unsigned long long ull;
const int N = 2e6+5,M = 1048576,K = 30;
inline int rd() {
int f = 0; int x = 0; char ch = getchar();
for (; !isdigit(ch); ch = getchar()) f |= (ch == '-');
for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
if (f) x = -x;
return x;
}
void write(int a) {if(a>=10)write(a/10);putchar(a%10+'0');}
void wt(int a) {if(a < 0) {putchar('-');a = -a;}write(a);}
void wwt(int a){wt(a);putchar('\n');}
int lowbit(int x) {return (x&(-x));}
int n,m,k;
int a[N];
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("in.txt", "r+", stdin);
freopen("out.txt", "w+", stdout);
#endif
int _;
for(cin >> _;_;_--)
{
cin >> n;
for(int i = 2;i<=n;i++)
{
cin >> a[i];
a[i] += a[i-1];
}
int res = 0,ans = 0;
for(int i = 1;i<=n;i++)
{
if(i%2)
{
ans += res;
}
else
{
res += a[n + 1 - i/2] - a[i/2];
ans += res;
}
cout << ans << ' ';
}
cout << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3388kb
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 '