結果

問題 No.9 モンスターのレベル上げ
ユーザー SakaTakuSakaTaku
提出日時 2020-09-11 13:08:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 363 ms / 5,000 ms
コード長 802 bytes
コンパイル時間 1,523 ms
コンパイル使用メモリ 174,364 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 19:11:29
合計ジャッジ時間 5,602 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 363 ms
4,380 KB
testcase_03 AC 296 ms
4,376 KB
testcase_04 AC 149 ms
4,376 KB
testcase_05 AC 98 ms
4,380 KB
testcase_06 AC 33 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 45 ms
4,380 KB
testcase_09 AC 348 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 279 ms
4,376 KB
testcase_12 AC 232 ms
4,376 KB
testcase_13 AC 166 ms
4,380 KB
testcase_14 AC 358 ms
4,380 KB
testcase_15 AC 327 ms
4,376 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 207 ms
4,376 KB
testcase_18 AC 172 ms
4,380 KB
testcase_19 AC 4 ms
4,376 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