/* -*- coding: utf-8 -*- * * 1375.cc: No.1375 Divide and Update - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 200000; const long long LINF = 1LL << 62; /* typedef */ typedef long long ll; /* global variables */ int as[MAX_N]; ll dpx[MAX_N + 1][3], dpy[MAX_N + 1][3]; /* subroutines */ /* main */ int main() { int n, x, y; scanf("%d%d%d", &n, &x, &y); for (int i = 0; i < n; i++) scanf("%d", as + i); dpx[0][0] = 0, dpx[0][1] = dpx[0][2] = -LINF; for (int i = 0; i < n; i++) { dpx[i + 1][0] = dpx[i][0] + as[i]; dpx[i + 1][1] = max(dpx[i][0], dpx[i][1]) + x; dpx[i + 1][2] = max(dpx[i][1], dpx[i][2]) + as[i]; } dpy[n][0] = 0, dpy[n][1] = dpy[n][2] = -LINF; for (int i = n - 1; i >= 0; i--) { dpy[i][0] = dpy[i + 1][0] + as[i]; dpy[i][1] = max(dpy[i + 1][0], dpy[i + 1][1]) + y; dpy[i][2] = max(dpy[i + 1][1], dpy[i + 1][2]) + as[i]; } for (int i = 1; i < n - 1; i++) { ll sum = max(dpx[i][1], dpx[i][2]) + as[i] + max(dpy[i + 1][1], dpy[i + 1][2]); printf("%lld\n", sum); } return 0; }