結果
問題 |
No.9 モンスターのレベル上げ
|
ユーザー |
![]() |
提出日時 | 2020-12-26 17:01:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 465 ms / 5,000 ms |
コード長 | 903 bytes |
コンパイル時間 | 1,870 ms |
コンパイル使用メモリ | 199,124 KB |
最終ジャッジ日時 | 2025-01-17 07:30:51 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) cin >> a.at(i); for (int i = 0; i < n; i++) cin >> b.at(i); int ans = 1e9; for (int start = 0; start < n; start++) { priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; for (int i = 0; i < n; i++) pq.push(make_pair(a[i], 0)); for (int add = 0; add < n; add++) { int now = (start + add) % n; auto [level, count] = pq.top(); pq.pop(); level += b[now] / 2; count++; pq.push(make_pair(level, count)); } int countmax = 0; while (!pq.empty()) { auto [level, count] = pq.top(); pq.pop(); countmax = max(countmax, count); } ans = min(ans, countmax); } cout << ans << '\n'; }