結果
問題 |
No.3049 Contest Coordinator
|
ユーザー |
![]() |
提出日時 | 2025-03-12 11:13:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 168 ms / 2,000 ms |
コード長 | 1,294 bytes |
コンパイル時間 | 2,405 ms |
コンパイル使用メモリ | 204,976 KB |
実行使用メモリ | 16,216 KB |
最終ジャッジ日時 | 2025-03-12 11:13:44 |
合計ジャッジ時間 | 15,307 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 58 |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/modint> using namespace std; //using namespace atcoder; using ll = long long; //using mint = modint998244353; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); /* Dをソートして差がT以下のグループをまとめる。これらは一塊として良い。 2つのグループを繋げる時、崖を作るか逆転を作るかはX, Yの大小で決める。 繋げる回数が少ない方が良いので大きいグループから繋げていく方が良い。 */ ll N, T, X, Y, now, cnt, S=0; cin >> N >> T >> X >> Y; X = min(X, Y); vector<ll> D(N), v, ans(N+1); for (int i=0; i<N; i++) cin >> D[i]; sort(D.begin(), D.end()); now = D[0]; cnt = 1; for (int i=1; i<N; i++){ if (D[i]-now<=T){ now = D[i]; cnt++; } else{ v.push_back(cnt); now = D[i]; cnt = 1; } } v.push_back(cnt); sort(v.rbegin(), v.rend()); now = 1; for (auto z : v){ for (int i=now; i<=now-1+z; i++){ ans[i] = S; } now = now+z; S += X; } for (int i=1; i<=N; i++) cout << ans[i] << " "; cout << endl; return 0; }