結果
| 問題 |
No.9 モンスターのレベル上げ
|
| ユーザー |
kkslucy1
|
| 提出日時 | 2018-04-03 23:16:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 527 ms / 5,000 ms |
| コード長 | 683 bytes |
| コンパイル時間 | 2,063 ms |
| コンパイル使用メモリ | 164,468 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 08:36:23 |
| 合計ジャッジ時間 | 6,948 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<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 ans = 1000000000;
for (int i = 0;i < n;i++) {
priority_queue<pair<int, int>> q;
for (int i = 0;i < n;i++) {
q.push(make_pair(-a[i], 0));
}
for (int j = 0;j < n;j++) {
int index = (i + j) % n;
auto qt = q.top();q.pop();
q.push(make_pair(qt.first - (b[index] / 2), qt.second - 1));
}
int ma = -1;
for (int j = 0;j < n;j++) {
auto qt = q.top();q.pop();
ma = max(ma, -qt.second);
}
ans = min(ans, ma);
}
cout << ans << endl;
return 0;
}
kkslucy1