結果

問題 No.9 モンスターのレベル上げ
ユーザー SakaTaku
提出日時 2020-09-11 13:04:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 789 bytes
コンパイル時間 2,164 ms
コンパイル使用メモリ 176,476 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 20:20:02
合計ジャッジ時間 6,816 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
using P = pair<int,int>;
int main() {
   priority_queue<P,vector<P>,greater<P>> que;
   int N;cin>>N;
   rep(i,N){
      int Ai;cin>>Ai;
      que.push({Ai,0});
   }
   priority_queue<P,vector<P>,greater<P>> def=que;
   vector<int>B;
   rep(i,N){
      int Bi;cin>>Bi;
      B.push_back(Bi);
   }
   int ans=1500;
   rep(j,N){
      que=def;
      rep(i,N){
         P now=que.top();
         que.pop();
         now={now.first+B[(i+j)%N],now.second+1};
         que.push(now);
      }
      int max_battle=0;
      while(!que.empty()){
         max_battle=max(max_battle,que.top().second);
         que.pop();
      }
      ans=min(ans,max_battle);
   }
   cout<<ans<<endl;
}
0