結果

問題 No.9 モンスターのレベル上げ
ユーザー SakaTakuSakaTaku
提出日時 2020-09-11 13:08:13
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 458 ms / 5,000 ms
コード長 802 bytes
コンパイル時間 1,527 ms
使用メモリ 3,596 KB
最終ジャッジ日時 2023-01-14 12:49:57
合計ジャッジ時間 6,701 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,448 KB
testcase_01 AC 1 ms
3,476 KB
testcase_02 AC 458 ms
3,516 KB
testcase_03 AC 364 ms
3,576 KB
testcase_04 AC 191 ms
3,560 KB
testcase_05 AC 124 ms
3,500 KB
testcase_06 AC 43 ms
3,384 KB
testcase_07 AC 2 ms
3,452 KB
testcase_08 AC 57 ms
3,396 KB
testcase_09 AC 445 ms
3,480 KB
testcase_10 AC 2 ms
3,484 KB
testcase_11 AC 372 ms
3,596 KB
testcase_12 AC 265 ms
3,408 KB
testcase_13 AC 197 ms
3,516 KB
testcase_14 AC 445 ms
3,480 KB
testcase_15 AC 404 ms
3,576 KB
testcase_16 AC 8 ms
3,456 KB
testcase_17 AC 259 ms
3,416 KB
testcase_18 AC 217 ms
3,420 KB
testcase_19 AC 5 ms
3,432 KB
権限があれば一括ダウンロードができます

ソースコード

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;
      Bi/=2;
      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