結果
問題 | No.3049 Contest Coordinator |
ユーザー |
|
提出日時 | 2025-03-07 21:40:22 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 161 ms / 2,000 ms |
コード長 | 1,350 bytes |
コンパイル時間 | 4,043 ms |
コンパイル使用メモリ | 284,740 KB |
実行使用メモリ | 14,656 KB |
最終ジャッジ日時 | 2025-03-07 21:40:34 |
合計ジャッジ時間 | 11,702 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 58 |
ソースコード
#include <bits/stdc++.h> #define F first #define S second #define all(x) begin(x), end(x) #define pb push_back #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #ifdef LOCAL #define HEHE freopen("in.txt", "r", stdin); #define debug(HEHE...) cerr << #HEHE << " = ", dout(HEHE) void dout() { std::cerr << '\n'; } template <typename T, typename ...U> void dout(T t, U ...u) { std::cerr << t << ' '; dout(u...); } #else #define HEHE ios_base::sync_with_stdio(0), cin.tie(0); #define debug(...) 7122 #endif using namespace std; #define chmax(a, b) (a) = (a) > (b) ? (a) : (b) #define chmin(a, b) (a) = (a) < (b) ? (a) : (b) #define int long long signed main() { HEHE // // #(a[i + 1] - a[i] > t) : p // #(a[i + 1] - a[i] < 0) : q // pX + qY int n, t, x, y; cin >> n >> t >> x >> y; vector<int> a(n); for (int &i : a) cin >> i; sort(all(a)); int cnt = 1; vector<int> tmp; FOR (i, 0, n - 2) { if (a[i + 1] - a[i] <= t) { cnt++; } else { if (cnt) tmp.pb(cnt); cnt = 1; } } tmp.pb(cnt); sort(all(tmp), greater()); partial_sum(all(tmp), begin(tmp)); vector<int> ans(n + 2); for (int i : tmp) ans[i + 1] += min(x, y); partial_sum(all(ans), begin(ans)); FOR (i, 1, n) cout << ans[i] << " \n"[i == n]; }