結果

問題 No.9 モンスターのレベル上げ
ユーザー cureskol
提出日時 2020-03-27 10:23:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 448 ms / 5,000 ms
コード長 633 bytes
コンパイル時間 1,715 ms
コンパイル使用メモリ 168,064 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-02 08:23:13
合計ジャッジ時間 6,553 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;


typedef pair<int,int> P;
signed 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=1e9;
  priority_queue<P,vector<P>,greater<P>> que;
  for(int start=0;start<n;start++){
    for(int i=0;i<n;i++)que.push(P(a[i],0));
    for(int j=0;j<n;j++){
      int te=b[(j+start)%n];
      P p=que.top();que.pop();
      que.push(P(p.first+te/2,p.second+1));
    }
    int tmp=0;
    while(que.size()){
      P p=que.top();que.pop();
      if(tmp<p.second)tmp=p.second;
    }
    if(ans>tmp)ans=tmp;
  }
  cout<<ans<<endl;
}
0