結果

問題 No.9 モンスターのレベル上げ
ユーザー CleyLCleyL
提出日時 2022-09-11 17:30:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 278 ms / 5,000 ms
コード長 962 bytes
コンパイル時間 735 ms
コンパイル使用メモリ 81,176 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-06 01:31:52
合計ジャッジ時間 3,959 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 278 ms
5,376 KB
testcase_03 AC 222 ms
5,376 KB
testcase_04 AC 112 ms
5,376 KB
testcase_05 AC 75 ms
5,376 KB
testcase_06 AC 26 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 33 ms
5,376 KB
testcase_09 AC 267 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 227 ms
5,376 KB
testcase_12 AC 235 ms
5,376 KB
testcase_13 AC 193 ms
5,376 KB
testcase_14 AC 276 ms
5,376 KB
testcase_15 AC 245 ms
5,376 KB
testcase_16 AC 5 ms
5,376 KB
testcase_17 AC 157 ms
5,376 KB
testcase_18 AC 125 ms
5,376 KB
testcase_19 AC 4 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct d{
  int l,b;
  bool operator==(const d a) const {
    return l==a.l && b==a.b;
  }
  bool operator<(const d a) const {
    if(l == a.l){
      return b < a.b;
    }
    return l < a.l;
  }
  bool operator>(const d a) const {
    return !(*this == a || *this < a);
  }
};

int main(){
  int n;cin>>n;
  priority_queue<d,vector<d>,greater<d>> A;
  vector<int> B(n);
  for(int i = 0; n > i; i++){
    cin>>B[i];
  }
  vector<int> C(n);
  for(int i = 0; n > i; i++){
    cin>>C[i];
  }
  int ans = n;
  for(int i = 0; n > i; i++){
    for(int j = 0; n > j; j++){
      A.push({B[j],0});
      
    }
    for(int j = 0; n > j; j++){
      auto z = A.top();A.pop();
      z.l += C[(i+j)%n]/2;
      z.b++;
      A.push(z);
    }
    int tmp = 0;
    while(A.size()){
      auto z = A.top();A.pop();
      tmp = max(tmp,z.b);
    }
    ans = min(ans,tmp);
  }
  cout << ans << endl;
}
0