結果
問題 |
No.2922 Rose Garden
|
ユーザー |
![]() |
提出日時 | 2024-11-12 04:35:22 |
言語 | Elixir (1.18.1) |
結果 |
AC
|
実行時間 | 1,635 ms / 3,000 ms |
コード長 | 707 bytes |
コンパイル時間 | 1,215 ms |
コンパイル使用メモリ | 63,108 KB |
実行使用メモリ | 98,844 KB |
最終ジャッジ日時 | 2024-11-12 04:36:29 |
合計ジャッジ時間 | 67,010 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
defmodule Main do def input, do: IO.read(:line) |> String.trim def ii, do: input() |> String.to_integer def li, do: input() |> String.split |> Enum.map(&String.to_integer/1) def yn(b), do: IO.puts (if b, do: "Yes", else: "No") def main do {_ok, c} = File.read("/dev/stdin") [x, y] = String.trim(c) |> String.split("\n") [_n, s, b] = x |> String.split() |> Enum.map(&String.to_integer/1) h = y |> String.split() |> Enum.map(&String.to_integer/1) init = Enum.at(h, 0) + s*b Enum.reduce_while(h, init, fn x, acc -> if acc < x do {:halt, -1} else {:cont, max(acc, x + s*b)} end end) |> then(fn x -> x > 0 end) |> yn() end end