結果
問題 |
No.9 モンスターのレベル上げ
|
ユーザー |
|
提出日時 | 2024-10-21 01:25:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 296 ms / 5,000 ms |
コード長 | 726 bytes |
コンパイル時間 | 2,244 ms |
コンパイル使用メモリ | 199,616 KB |
最終ジャッジ日時 | 2025-02-24 22:06:21 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(nullptr)->sync_with_stdio(false); using P = pair<int, int>; int N; cin >> N; int A[N], B[N]; for(int i = 0; i < N; ++i) cin >> A[i]; for(int i = 0; i < N; ++i) cin >> B[i]; int ret = 1e9; for(int i = 0; i < N; ++i){ priority_queue<P, vector<P>, greater<P>> que; for(int j = 0; j < N; ++j){ que.emplace(A[j], 0); } int res = 0; for(int j = 0; j < N; ++j){ const auto [cur_health, fight_till_now] = que.top(); que.pop(); res = max(res, fight_till_now + 1); que.emplace(cur_health + B[(i + j) % N] / 2, fight_till_now + 1); } ret = min(ret, res); } cout << ret << endl; return 0; }