結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー te-shte-sh
提出日時 2016-09-05 13:20:24
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 1,168 ms / 5,000 ms
コード長 709 bytes
コンパイル時間 3,320 ms
コンパイル使用メモリ 162,848 KB
実行使用メモリ 12,468 KB
最終ジャッジ日時 2023-09-02 21:55:29
合計ジャッジ時間 25,438 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
10,124 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 424 ms
5,548 KB
testcase_03 AC 813 ms
6,968 KB
testcase_04 AC 1,084 ms
12,420 KB
testcase_05 AC 1,086 ms
12,272 KB
testcase_06 AC 1,069 ms
11,392 KB
testcase_07 AC 1,168 ms
10,256 KB
testcase_08 AC 1,156 ms
10,288 KB
testcase_09 AC 1,064 ms
12,036 KB
testcase_10 AC 962 ms
6,892 KB
testcase_11 AC 1,032 ms
12,232 KB
testcase_12 AC 916 ms
6,740 KB
testcase_13 AC 1,061 ms
10,752 KB
testcase_14 AC 1,102 ms
11,592 KB
testcase_15 AC 901 ms
11,832 KB
testcase_16 AC 1,046 ms
11,416 KB
testcase_17 AC 1,043 ms
11,428 KB
testcase_18 AC 917 ms
12,468 KB
testcase_19 AC 971 ms
11,532 KB
testcase_20 AC 749 ms
10,084 KB
testcase_21 AC 654 ms
11,596 KB
testcase_22 AC 613 ms
6,848 KB
testcase_23 AC 762 ms
11,684 KB
testcase_24 AC 2 ms
4,372 KB
testcase_25 AC 22 ms
4,376 KB
testcase_26 AC 9 ms
4,372 KB
testcase_27 AC 6 ms
4,368 KB
testcase_28 AC 173 ms
4,372 KB
testcase_29 AC 84 ms
4,368 KB
testcase_30 AC 23 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.conv, std.stdio, std.typecons;

void main()
{
  auto n = readln.chomp.to!long;
  auto li = readln.split.map!(to!long);
  auto k = readln.chomp.to!long;

  auto maxL = li.reduce!(max);

  bool calc(real x, real _) {
    long c = 0;
    foreach (l; li) {
      auto d = (l / x).floor;
      if (d >= long.max || d >= long.max - c || c + d >= k)
        return true;
      c += d.to!long;
    }
    return c >= k;
  }

  auto eps = 10.to!real ^^ (-10);
  auto r = iota(eps, maxL, eps).assumeSorted!(calc).lowerBound(0);
  writefln("%.9f", r.back);
}
0