結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-06 16:40:36 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 317 ms / 5,000 ms |
| コード長 | 847 bytes |
| 記録 | |
| コンパイル時間 | 766 ms |
| コンパイル使用メモリ | 90,772 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-16 10:42:09 |
| 合計ジャッジ時間 | 4,525 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include<iostream>
#include<queue>
using namespace std;
int main(){
int n;
cin >> n;
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 = 10001;
for(int i = 0; i < n; i++){
priority_queue<pair<int,int>> pq;
for(int j = 0; j < n; j++) pq.push(make_pair(-a[j], 0));
for(int j = 0; j < n; j++){
int encount = b[(i+j)%n];
pair<int,int> monster = pq.top(); pq.pop();
monster.first -= encount/2;
monster.second--;
pq.push(monster);
}
int tmpmax = 0;
while(!pq.empty()){
pair<int,int> p = pq.top(); pq.pop();
tmpmax = max(tmpmax, -p.second);
}
ans = min(ans, tmpmax);
}
cout << ans << endl;
return 0;
}