結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2016-10-08 00:45:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 498 ms / 5,000 ms |
コード長 | 879 bytes |
コンパイル時間 | 703 ms |
コンパイル使用メモリ | 68,272 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 23:44:32 |
合計ジャッジ時間 | 5,458 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <cstdio> #include <queue> #include <algorithm> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i,n) for(int i=0;i<(n);i++) const int INF = 1e9; int n; int a[3010], b[3010]; int main(void){ cin >> n; rep(i, n){ cin >> a[i]; a[i + n] = a[i]; } rep(i, n){ cin >> b[i]; b[i + n] = b[i]; } int ans = INF; rep(i, n){ priority_queue<P, vector<P>, greater<P> > pq; for (int j = 0; j < n; ++j){ pq.push(make_pair(a[j], 0)); } for (int j = i; j < i + n; ++j){ int nlv = pq.top().first; int t = pq.top().second; pq.pop(); int lvup = b[j] / 2; pq.push(make_pair(nlv + lvup, t + 1)); } int tmp = 0; while(!pq.empty()){ int t = pq.top().second; pq.pop(); tmp = max(tmp, t); } ans = min(ans, tmp); } printf("%d\n", ans); return 0; }