結果

問題 No.9 モンスターのレベル上げ
ユーザー SakaTakuSakaTaku
提出日時 2020-09-11 13:04:45
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 789 bytes
コンパイル時間 1,863 ms
コンパイル使用メモリ 175,624 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-26 19:06:44
合計ジャッジ時間 5,752 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 289 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 35 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 179 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 6 ms
4,380 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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