結果

問題 No.9 モンスターのレベル上げ
ユーザー luckylatluckylat
提出日時 2022-09-11 17:30:31
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 309 ms / 5,000 ms
コード長 962 bytes
コンパイル時間 627 ms
使用メモリ 3,576 KB
最終ジャッジ日時 2023-01-04 23:18:14
合計ジャッジ時間 4,677 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,528 KB
testcase_01 AC 1 ms
3,500 KB
testcase_02 AC 309 ms
3,576 KB
testcase_03 AC 250 ms
3,480 KB
testcase_04 AC 127 ms
3,572 KB
testcase_05 AC 84 ms
3,496 KB
testcase_06 AC 29 ms
3,540 KB
testcase_07 AC 2 ms
3,512 KB
testcase_08 AC 38 ms
3,400 KB
testcase_09 AC 302 ms
3,572 KB
testcase_10 AC 1 ms
3,440 KB
testcase_11 AC 251 ms
3,420 KB
testcase_12 AC 256 ms
3,576 KB
testcase_13 AC 213 ms
3,568 KB
testcase_14 AC 304 ms
3,468 KB
testcase_15 AC 275 ms
3,412 KB
testcase_16 AC 6 ms
3,492 KB
testcase_17 AC 173 ms
3,464 KB
testcase_18 AC 143 ms
3,536 KB
testcase_19 AC 4 ms
3,540 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