結果
問題 |
No.3221 Count Turns
|
ユーザー |
|
提出日時 | 2025-08-01 22:37:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 777 bytes |
コンパイル時間 | 1,740 ms |
コンパイル使用メモリ | 205,548 KB |
実行使用メモリ | 8,956 KB |
最終ジャッジ日時 | 2025-08-01 22:37:32 |
合計ジャッジ時間 | 3,847 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 WA * 26 |
ソースコード
#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]) % h, -i); } while(t--){ auto [cnt, d, idx] = pq.top(); idx *= -1; pq.pop(); c[idx]++; ll add = (h - d + a[idx] - 1) / a[idx]; cnt -= add; d += a[idx] * add; d %= h; pq.emplace(cnt, d, -idx); } for(int i = 0; i < n; i++) cout << c[i] << (i + 1 == n ? '\n' : ' '); }