結果

問題 No.3221 Count Turns
ユーザー HoyHoyCharhang
提出日時 2025-08-01 22:04:30
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 1,110 bytes
コンパイル時間 3,213 ms
コンパイル使用メモリ 286,680 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-01 22:04:36
合計ジャッジ時間 6,336 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define eb emplace_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<typename T> using pq = priority_queue<T,vector<T>,greater<T>>;
using P = pair<int,int>;
template<class T>bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,T b){if(b<a){a=b;return 1;}return 0;}

int main() {
  int n, h, t;
  cin >> n >> h >> t;
  pq<pair<ll,P>> que;
  vector<int> a(n), k(n);
  rep(i,0,n) {
    cin >> a[i];
    k[i] = dup(h, a[i]);
    que.emplace(k[i], P{h-k[i]*a[i], i});
  }
  vector<int> c(n);
  while(t--) {
    ll v; P p;
    tie(v, p) = que.top();
    que.pop();
    ++c[p.se];
    que.emplace(v+k[p.se], p);
  }
  rep(i,0,n) {
    cout << c[i] << " ";
  }
  cout << endl;
  return 0;
}
0