結果

問題 No.9 モンスターのレベル上げ
ユーザー kk
提出日時 2014-10-30 09:14:04
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 226 ms / 5,000 ms
コード長 957 bytes
コンパイル時間 523 ms
使用メモリ 3,560 KB
最終ジャッジ日時 2023-01-21 13:40:45
合計ジャッジ時間 3,588 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,356 KB
testcase_01 AC 1 ms
3,500 KB
testcase_02 AC 226 ms
3,392 KB
testcase_03 AC 180 ms
3,472 KB
testcase_04 AC 95 ms
3,496 KB
testcase_05 AC 63 ms
3,500 KB
testcase_06 AC 23 ms
3,536 KB
testcase_07 AC 1 ms
3,496 KB
testcase_08 AC 29 ms
3,504 KB
testcase_09 AC 221 ms
3,528 KB
testcase_10 AC 1 ms
3,536 KB
testcase_11 AC 148 ms
3,476 KB
testcase_12 AC 125 ms
3,556 KB
testcase_13 AC 138 ms
3,424 KB
testcase_14 AC 221 ms
3,560 KB
testcase_15 AC 200 ms
3,436 KB
testcase_16 AC 5 ms
3,428 KB
testcase_17 AC 128 ms
3,560 KB
testcase_18 AC 108 ms
3,508 KB
testcase_19 AC 3 ms
3,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <string>

using namespace std;

int main() {
  int n;
  cin >> n;
  priority_queue <pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > a;
  int b[n];
  for (int i = 0; i < n; i++) {
    int t; cin >> t; a.push(make_pair(t, 0));
  }
  for (int i = 0; i < n; i++) cin >> b[i];

  int ans = 1e9;
  for (int i = 0; i < n; i++) {
    int t = 0;
    priority_queue <pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > ta = a;
    for (int j = 0; j < n; j++) {
      pair <int, int> p = ta.top(); ta.pop();
      p.first += b[(i+j)%n]/2;
      p.second++;
      t = max(t, p.second);
      ta.push(p);
    }
    ans = min(ans, t);
  }
  cout << ans << endl;
}
0