結果
問題 |
No.3221 Count Turns
|
ユーザー |
|
提出日時 | 2025-08-01 22:40:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 49 ms / 2,000 ms |
コード長 | 735 bytes |
コンパイル時間 | 2,086 ms |
コンパイル使用メモリ | 206,592 KB |
実行使用メモリ | 8,692 KB |
最終ジャッジ日時 | 2025-08-01 22:40:14 |
合計ジャッジ時間 | 4,583 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll n, h, t; cin >> n >> h >> t; vector<ll> a(n); vector<int> c(n); // 何回足す,オフセット,添え字 priority_queue<tuple<ll,ll,int>> pq; for(int i = 0; i < n; i++){ cin >> a[i]; ll d = (h + a[i] - 1) / a[i]; pq.emplace(-d, d * a[i], -i); } while(t--){ auto [cnt, d, idx] = pq.top(); idx *= -1; pq.pop(); c[idx]++; ll add = (h + a[idx] - 1) / a[idx]; cnt -= add; pq.emplace(cnt, a[idx] * add, -idx); } for(int i = 0; i < n; i++) cout << c[i] << (i + 1 == n ? '\n' : ' '); }