結果
問題 |
No.3221 Count Turns
|
ユーザー |
![]() |
提出日時 | 2025-08-03 18:53:39 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 1,322 bytes |
コンパイル時間 | 3,428 ms |
コンパイル使用メモリ | 282,740 KB |
実行使用メモリ | 8,348 KB |
最終ジャッジ日時 | 2025-08-03 18:53:46 |
合計ジャッジ時間 | 5,759 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for(ll i=0; i<(ll)(n); i++) template<typename T> bool chmax(T& a, T b) { return a<b ? a=b, true : false; } template<typename T> bool chmin(T& a, T b) { return a>b ? a=b, true : false; } using ll=long long; const int INF=1e9+10; const ll INFL=4e18; using VI=vector<int>; using VVI=vector<VI>; using VL=vector<ll>; using VVL=vector<VL>; using PL=pair<ll,ll>; using VP=vector<PL>; using WG=vector<vector<pair<int,ll>>>; #ifdef LOCAL #include "./debug.hpp" #else #define debug(...) #define print_line #endif //---------------------------------------------------------- void solve() { ll N,H,T; cin>>N>>H>>T; VL A(N); REP(i,N) cin>>A[i]; priority_queue<array<ll,3>> pq; REP(i,N) { ll a=(H+A[i]-1)/A[i];//Hを超えるまでの時間 ll b=H-A[i]*a;//a回操作したときの値 pq.push({-a,-b,-i}); } VL ans(N); REP(t,T) { auto [a,b,i]=pq.top(); pq.pop(); a=-a; b=-b; i=-i; ans[i]++; a+=(H+A[i]-1)/A[i]; pq.push({-a,-b,-i}); } REP(i,N) cout<<ans[i]<<' '; cout<<'\n'; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); //cout<<fixed<<setprecision(15); int T=1; //cin>>T; while(T--) solve(); }