結果
| 問題 |
No.9 モンスターのレベル上げ
|
| ユーザー |
kyuna
|
| 提出日時 | 2020-04-28 07:30:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 429 ms / 5,000 ms |
| コード長 | 865 bytes |
| コンパイル時間 | 887 ms |
| コンパイル使用メモリ | 83,728 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-23 22:57:50 |
| 合計ジャッジ時間 | 5,396 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
using namespace std;
template<class T> using min_heap = priority_queue<T, vector<T>, greater<T>>;
const int INF = (int)1e9 + 7;
int main() {
int n; cin >> n;
vector<int> a(n);
for (auto &ai: a) cin >> ai;
vector<int> b(n);
for (auto &bi: b) cin >> bi;
int mi = INF;
for (int ofs = 0; ofs < n; ofs++) {
min_heap<pair<int, int>> pq;
for (auto &ai: a) pq.emplace(ai, 0);
for (int i = 0; i < n; i++) {
int cur = b[(i + ofs) % n];
int lvl, cnt; tie(lvl, cnt) = pq.top(); pq.pop();
pq.emplace(lvl + cur / 2, cnt + 1);
}
int ma = 0;
while (!pq.empty()) ma = max(ma, pq.top().second), pq.pop();
mi = min(mi, ma);
}
cout << mi << endl;
return 0;
}
kyuna