結果
| 問題 |
No.3049 Contest Coordinator
|
| コンテスト | |
| ユーザー |
SnowBeenDiding
|
| 提出日時 | 2025-03-07 21:16:57 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 163 ms / 2,000 ms |
| コード長 | 1,119 bytes |
| コンパイル時間 | 6,974 ms |
| コンパイル使用メモリ | 333,424 KB |
| 実行使用メモリ | 12,772 KB |
| 最終ジャッジ日時 | 2025-03-07 21:17:12 |
| 合計ジャッジ時間 | 14,700 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 58 |
ソースコード
#include <atcoder/all>
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;
typedef long long ll;
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
int n = v.size();
rep(i, 0, n) { os << v[i] << " \n"[i == n - 1]; }
return os;
}
int main() {
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int n, t, x, y;
cin >> n >> t >> x >> y;
x = min(x, y);
vector<int> a(n);
rep(i, 0, n) cin >> a[i];
sort(a.begin(), a.end());
vector<int> gake;
gake.push_back(0);
rep(i, 0, n - 1) {
if (a[i + 1] - a[i] > t) {
gake.push_back(i + 1);
}
}
gake.push_back(n);
vector<int> kat;
rep(i, 0, gake.size() - 1) { kat.push_back(gake[i + 1] - gake[i]); }
sort(kat.rbegin(), kat.rend());
vector<ll> ans(n);
for (int i = n - 1; i >= 0; i--) {
int p = kat.size() - 1;
ans[i] = (ll)p * x;
kat.back()--;
if (kat.back() == 0) {
kat.pop_back();
}
}
cout << ans;
}
SnowBeenDiding