結果

問題 No.9 モンスターのレベル上げ
ユーザー kk
提出日時 2014-10-30 09:14:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 229 ms / 5,000 ms
コード長 957 bytes
コンパイル時間 931 ms
コンパイル使用メモリ 77,956 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-06 03:08:39
合計ジャッジ時間 3,845 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 229 ms
4,384 KB
testcase_03 AC 184 ms
4,504 KB
testcase_04 AC 97 ms
4,380 KB
testcase_05 AC 65 ms
4,384 KB
testcase_06 AC 23 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 30 ms
4,384 KB
testcase_09 AC 225 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 150 ms
4,384 KB
testcase_12 AC 124 ms
4,380 KB
testcase_13 AC 137 ms
4,384 KB
testcase_14 AC 227 ms
4,380 KB
testcase_15 AC 204 ms
4,384 KB
testcase_16 AC 5 ms
4,384 KB
testcase_17 AC 130 ms
4,384 KB
testcase_18 AC 111 ms
4,384 KB
testcase_19 AC 3 ms
4,384 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