結果

問題 No.9 モンスターのレベル上げ
ユーザー CleyLCleyL
提出日時 2022-09-11 17:30:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 284 ms / 5,000 ms
コード長 962 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-18 19:48:43
合計ジャッジ時間 4,142 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 284 ms
4,376 KB
testcase_03 AC 218 ms
4,380 KB
testcase_04 AC 111 ms
4,376 KB
testcase_05 AC 74 ms
4,376 KB
testcase_06 AC 25 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 33 ms
4,504 KB
testcase_09 AC 271 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 227 ms
4,380 KB
testcase_12 AC 226 ms
4,376 KB
testcase_13 AC 198 ms
4,376 KB
testcase_14 AC 274 ms
4,380 KB
testcase_15 AC 241 ms
4,376 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 152 ms
4,380 KB
testcase_18 AC 128 ms
4,380 KB
testcase_19 AC 4 ms
4,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