結果

問題 No.9 モンスターのレベル上げ
ユーザー AuroraAurora
提出日時 2022-05-06 22:38:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 446 ms / 5,000 ms
コード長 682 bytes
コンパイル時間 1,690 ms
コンパイル使用メモリ 174,156 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 03:42:25
合計ジャッジ時間 6,655 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 446 ms
4,380 KB
testcase_03 AC 358 ms
4,376 KB
testcase_04 AC 187 ms
4,376 KB
testcase_05 AC 122 ms
4,380 KB
testcase_06 AC 41 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 55 ms
4,380 KB
testcase_09 AC 430 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 372 ms
4,376 KB
testcase_12 AC 300 ms
4,380 KB
testcase_13 AC 196 ms
4,380 KB
testcase_14 AC 432 ms
4,376 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 213 ms
4,380 KB
testcase_19 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int 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];
  for(int i=0;i<N;i++) B.push_back(B[i]);
  int ans = 1000000000;
  for(int i=0;i<N;i++){
    priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> que;
    for(int j=0;j<N;j++) que.push(make_pair(A[j],0));
    for(int j=i;j<i+N;j++){
      que.push(make_pair(que.top().first+B[j]/2,que.top().second+1));
      que.pop();
    }
    int Max = 0;
    for(int j=0;j<N;j++){
      Max = max(Max,que.top().second);
      que.pop();
    }
    ans = min(ans,Max);
  }
  cout << ans << endl;
}
0