結果
| 問題 | No.3221 Count Turns |
| コンテスト | |
| ユーザー |
applejam
|
| 提出日時 | 2026-01-04 21:54:14 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 1,418 bytes |
| 記録 | |
| コンパイル時間 | 6,509 ms |
| コンパイル使用メモリ | 382,596 KB |
| 実行使用メモリ | 9,776 KB |
| 最終ジャッジ日時 | 2026-01-04 21:54:25 |
| 合計ジャッジ時間 | 9,482 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vmi = vector<mint>;
using vvmi = vector<vmi>;
using vvvmi = vector<vvmi>;
#define all(a) (a).begin(), (a).end()
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define drep(i, n) drep2(i, n, 0)
void solve(){
}
using p = pair<ll, ll>;
using q = pair<ll, p>;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n, h, t; cin >> n >> h >> t;
vll a(n); rep(i, n)cin >> a[i];
vll ans(n, 0);
vll b(n); rep(i, n)b[i] = (h+a[i]-1)/a[i];
auto comp = [](q a, q b) -> bool{
if(a.first != b.first)return a.first > b.first;
if(a.second.first != b.second.first)return a.second.first < b.second.first;
return a.second.second > b.second.second;
};
priority_queue<q, vector<q>, decltype(comp)> pq(comp);
rep(i, n)pq.push({b[i], {b[i]*a[i], i}});
rep(i, t){
auto [c, d] = pq.top(); pq.pop();
ans[d.second]++;
pq.push({c+b[d.second], d});
}
rep(i, n)cout << ans[i] << " ";
cout << endl;
return 0;
}
applejam