結果

問題 No.3221 Count Turns
ユーザー mono
提出日時 2025-08-01 21:47:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 1,483 bytes
コンパイル時間 3,749 ms
コンパイル使用メモリ 227,896 KB
実行使用メモリ 8,728 KB
最終ジャッジ日時 2025-08-01 21:47:28
合計ジャッジ時間 7,091 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:53:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   53 |         auto [num,z,id] = pq.top(); pq.pop();
      |              ^

ソースコード

diff #

#include <bits/stdc++.h>
#include <stdlib.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
#define rep(i, a, n) for(ll i = a; i < n; i++)
#define rrep(i, a, n) for(ll i = a; i >= n; i--)
#define inr(l, x, r) (l <= x && x < r)
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) (x).begin(), (x).end()
//constexpr ll MOD = 1000000007;
constexpr ll MOD = 998244353;
constexpr int IINF = 1001001001;
constexpr ll INF = 1LL<<60;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

using mint = modint998244353;

ll gcd(ll a, ll b){
    if(a%b == 0){
      return b;
    }else{
      return gcd(b, a%b);
    }
}

ll lcm(ll a, ll b){
    return a*b / gcd(a, b);
}

ll powMod(ll x, ll n, ll mod) {
    if (n == 0) return 1 % mod;
    ll val = powMod(x, n / 2, mod);
    val *= val;
    val %= mod;
    if (n % 2 == 1) val *= x;
    return val % mod;
}

int main() {
    ll n, h, t; cin >> n >> h >> t;
    vector<ll> a(n);
    rep(i,0,n) cin >> a[i];
    vector<ll> ans(n);
    priority_queue<tuple<ll,ll,ll>,vector<tuple<ll,ll,ll>>,greater<tuple<ll,ll,ll>>> pq;
    rep(i,0,n){
        pq.push({(h-1)/a[i]+1,-a[i]*((h-1)/a[i]+1),i});
    }
    rep(_,0,t){
        auto [num,z,id] = pq.top(); pq.pop();
        ans[id]++;
        pq.push({num+(h-1)/a[id]+1,-a[id]*((h-1)/a[id]+1),id});
    }
    for(auto x: ans) cout << x << " ";
    cout << endl;
    return 0;
}
0