結果
問題 |
No.3221 Count Turns
|
ユーザー |
![]() |
提出日時 | 2025-08-02 17:41:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 861 bytes |
コンパイル時間 | 641 ms |
コンパイル使用メモリ | 63,120 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-08-02 17:41:34 |
合計ジャッジ時間 | 3,163 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 6 WA * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:32:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 32 | scanf("%d%d%d", &n, &h, &t); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~ main.cpp:33:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 33 | for (int i = 0; i < n; i++) scanf("%d", as + i); | ~~~~~^~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 3221.cc: No.3221 Count Turns - yukicoder */ #include<cstdio> #include<queue> #include<algorithm> #include<utility> using namespace std; /* constant */ const int MAX_N = 100000; /* typedef */ using ll = long long; using pli = pair<ll,int>; /* global variables */ int as[MAX_N], ds[MAX_N], cs[MAX_N]; /* subroutines */ /* main */ int main() { int n, h, t; scanf("%d%d%d", &n, &h, &t); for (int i = 0; i < n; i++) scanf("%d", as + i); for (int i = 0; i < n; i++) ds[i] = (h + as[i] - 1) / as[i]; priority_queue<pli> q; for (int i = 0; i < n; i++) q.push({-ds[i], -i}); while (t > 0) { auto [d, i] = q.top(); q.pop(); d = -d, i = -i; q.push({-(d + ds[i]), -i}); cs[i]++; t--; } for (int i = 0; i < n; i++) printf("%d%c", cs[i], (i + 1 < n) ? ' ' : '\n'); return 0; }