結果

問題 No.9 モンスターのレベル上げ
ユーザー cureskolcureskol
提出日時 2020-03-27 10:23:49
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 444 ms / 5,000 ms
コード長 633 bytes
コンパイル時間 1,788 ms
コンパイル使用メモリ 172,060 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-30 16:15:28
合計ジャッジ時間 6,762 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 444 ms
4,376 KB
testcase_03 AC 356 ms
4,376 KB
testcase_04 AC 184 ms
4,380 KB
testcase_05 AC 121 ms
4,380 KB
testcase_06 AC 41 ms
4,384 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 54 ms
4,376 KB
testcase_09 AC 431 ms
4,380 KB
testcase_10 AC 1 ms
4,500 KB
testcase_11 AC 376 ms
4,376 KB
testcase_12 AC 295 ms
4,380 KB
testcase_13 AC 201 ms
4,376 KB
testcase_14 AC 432 ms
4,380 KB
testcase_15 AC 395 ms
4,380 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 251 ms
4,380 KB
testcase_18 AC 210 ms
4,376 KB
testcase_19 AC 5 ms
4,376 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