結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
37kt_
|
| 提出日時 | 2015-10-28 11:51:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 247 ms / 5,000 ms |
| コード長 | 652 bytes |
| コンパイル時間 | 1,648 ms |
| コンパイル使用メモリ | 165,360 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 23:15:47 |
| 合計ジャッジ時間 | 4,211 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
int n;
int a[1500], b[3000];
int calc(int a[], int b[])
{
priority_queue<P, vector<P>, greater<P>> pq;
for (int i = 0; i < n; i++){
pq.push(P(a[i], 0));
}
int res = 0;
for (int i = 0; i < n; i++){
int lv, ct;
tie(lv, ct) = pq.top(); pq.pop();
pq.push(P(lv + b[i] / 2, ct + 1));
res = max(res, ct + 1);
}
return res;
}
int main()
{
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n; i++) cin >> b[i], b[i + n] = b[i];
int res = 1 << 28;
for (int i = 0; i < n; i++){
res = min(res, calc(a, b + i));
}
cout << res << endl;
}
37kt_