#if __INCLUDE_LEVEL__ == 0 #include __BASE_FILE__ void Solve() { int n, T; int64_t X, Y; IN(n, T, X, Y); vector a(n); IN(a); ranges::sort(a); vector p{0}; p.reserve(n + 1); for (int i : Rep(1, n)) { if (a[i - 1] + T < a[i]) { p.push_back(i); } } p.push_back(n); vector b(Sz(p) - 1); for (int pi : Rep(1, Sz(p))) { b[pi - 1] = p[pi] - p[pi - 1]; } ranges::sort(b, greater{}); partial_sum(ALL(b), b.begin()); vector ans(n); int L = 0; for (int bi : Rep(0, Sz(b))) { int R = b[bi]; for (int i : Rep(L, R)) { ans[i] = min(X, Y) * bi; } L = R; } OUT(ans); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); Solve(); } #elif __INCLUDE_LEVEL__ == 1 #include template concept MyRange = std::ranges::range && !std::convertible_to; template concept MyTuple = std::__is_tuple_like::value && !MyRange; namespace std { istream& operator>>(istream& is, MyRange auto&& r) { for (auto&& e : r) is >> e; return is; } istream& operator>>(istream& is, MyTuple auto&& t) { apply([&](auto&... xs) { (is >> ... >> xs); }, t); return is; } ostream& operator<<(ostream& os, MyRange auto&& r) { auto sep = ""; for (auto&& e : r) os << exchange(sep, " ") << e; return os; } ostream& operator<<(ostream& os, MyTuple auto&& t) { auto sep = ""; apply([&](auto&... xs) { ((os << exchange(sep, " ") << xs), ...); }, t); return os; } } // namespace std using namespace std; #define ALL(r) begin(r), end(r) #define Rep(...) [](int l, int r) { return views::iota(min(l, r), r); }(__VA_ARGS__) #define Sz(r) int(size(r)) #define IN(...) (cin >> forward_as_tuple(__VA_ARGS__)) #define OUT(...) (cout << forward_as_tuple(__VA_ARGS__) << '\n') #endif // __INCLUDE_LEVEL__ == 1