結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
|
提出日時 | 2015-02-22 16:10:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 424 ms / 5,000 ms |
コード長 | 802 bytes |
コンパイル時間 | 609 ms |
コンパイル使用メモリ | 72,196 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-06-23 22:30:07 |
合計ジャッジ時間 | 5,059 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <iostream> #include <queue> #include <functional> #include <algorithm> typedef std::pair<int, int> P; //Lv,cnt typedef std::priority_queue< P, std::vector<P>, std::greater<P> > Q; int n; int a[1501], b[1501]; int ans = 100000000; int main(){ std::cin >> n; for (int i = 0; i < n; i++)std::cin >> a[i]; for (int i = 0; i < n; i++)std::cin >> b[i]; for (int i = 0; i < n; i++){ Q que; for (int j = 0; j < n; j++)que.push(P(a[j], 0)); for (int j = 0; j < n; j++){ int t = (i + j) % n; P p = que.top(); que.pop(); p.first += b[t] / 2; p.second++; que.push(p); } int max = 0; for (int i = 0; i < n; i++){ P p = que.top(); que.pop(); max = std::max(max, p.second); } ans = std::min(ans, max); } std::cout << ans << std::endl; return 0; }