結果

問題 No.9 モンスターのレベル上げ
ユーザー nebukuro09nebukuro09
提出日時 2016-11-02 17:06:52
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 808 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 98,496 KB
実行使用メモリ 4,828 KB
最終ジャッジ日時 2023-09-02 22:42:26
合計ジャッジ時間 9,463 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,368 KB
testcase_01 AC 2 ms
4,368 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,372 KB
testcase_11 AC 743 ms
4,368 KB
testcase_12 AC 768 ms
4,372 KB
testcase_13 AC 554 ms
4,368 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 474 ms
4,368 KB
testcase_18 AC 400 ms
4,372 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.container;

void main() {
  int N = readln().chomp.to!int;
  //auto C = readln().split.map!(to!int).array.heapify!"a > b";
  auto C = readln().split.map!(to!int);
  Tuple!(int, int)[] D = new Tuple!(int, int)[](N);
  foreach (i; iota(N))
    D[i] = tuple(C[i], 0);
  
  auto B = readln().split.map!(to!int).array;

  int ans = int.max;
  foreach (i; iota(N)) {
    int m = 0;
    auto A = D.heapify!"a > b";
    foreach (j; iota(N)) {
      Tuple!(int, int) top = A.front;
      A.removeFront;
      A.insert(tuple(top[0]+B[(i+j)%N]/2, top[1]+1));
    }
    foreach(a; A.take(N))
      if (a[1] > m)
        m = a[1];
    ans = min(ans, m);
  }

  writeln(ans);
}
0