結果

問題 No.9 モンスターのレベル上げ
ユーザー cureskolcureskol
提出日時 2020-03-27 10:23:49
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 376 ms / 5,000 ms
コード長 633 bytes
コンパイル時間 2,107 ms
使用メモリ 6,948 KB
最終ジャッジ日時 2023-01-17 11:13:59
合計ジャッジ時間 6,860 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
4,896 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 376 ms
4,904 KB
testcase_03 AC 285 ms
4,896 KB
testcase_04 AC 150 ms
6,948 KB
testcase_05 AC 97 ms
4,900 KB
testcase_06 AC 33 ms
4,896 KB
testcase_07 AC 2 ms
4,904 KB
testcase_08 AC 44 ms
4,900 KB
testcase_09 AC 350 ms
6,948 KB
testcase_10 AC 2 ms
4,900 KB
testcase_11 AC 305 ms
6,948 KB
testcase_12 AC 237 ms
4,900 KB
testcase_13 AC 181 ms
4,900 KB
testcase_14 AC 345 ms
4,904 KB
testcase_15 AC 313 ms
4,900 KB
testcase_16 AC 6 ms
4,900 KB
testcase_17 AC 198 ms
4,900 KB
testcase_18 AC 167 ms
4,900 KB
testcase_19 AC 3 ms
4,896 KB
権限があれば一括ダウンロードができます

ソースコード

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