結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
fiord
|
| 提出日時 | 2015-07-09 23:54:36 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 304 ms / 5,000 ms |
| コード長 | 683 bytes |
| コンパイル時間 | 1,597 ms |
| コンパイル使用メモリ | 166,748 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 22:43:58 |
| 合計ジャッジ時間 | 4,736 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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=(1<<30);
for(int s=0;s<n;s++){
priority_queue<pair<int,int> > pq;
for(int i=0;i<n;i++) pq.push(make_pair(-1*a[i],0));
int temp=0;
for(int i=s;i<n;i++){
int x=pq.top().first; x-=b[i]/2;
int y=pq.top().second; y--;
temp=max(temp,-1*y);
pq.pop(); pq.push(make_pair(x,y));
}
for(int i=0;i<s;i++){
int x=pq.top().first; x-=b[i]/2;
int y=pq.top().second; y--;
temp=max(temp,-1*y);
pq.pop(); pq.push(make_pair(x,y));
}
ans=min(ans,temp);
}
cout<<ans<<endl;
return 0;
}
fiord