結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2017-02-04 17:15:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 424 ms / 5,000 ms |
コード長 | 844 bytes |
コンパイル時間 | 1,634 ms |
コンパイル使用メモリ | 165,520 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 23:54:47 |
合計ジャッジ時間 | 5,990 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) typedef long long ll; static const int INF = 1e8; int main(void){ int N; int a[3010],b[3010]; 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<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq; for(int j=0;j<N;++j){ pq.push(make_pair(a[j],0)); } for(int j = i; j < i + N;j++){ int llv=pq.top().first; int t = pq.top().second; pq.pop(); int lvup = b[j] /2; pq.push(make_pair(llv + lvup,t+1)); } int tmp = 0; while(!pq.empty()){ int t = pq.top().second;pq.pop(); tmp = max(tmp,t); } ans = min(ans,tmp); } cout << ans << endl; return 0; }