結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー gemmarogemmaro
提出日時 2020-05-01 11:46:04
言語 Elixir
(1.16.2)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 2,984 ms
コンパイル使用メモリ 53,100 KB
実行使用メモリ 51,284 KB
最終ジャッジ日時 2023-09-03 16:59:00
合計ジャッジ時間 21,454 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 586 ms
49,272 KB
testcase_03 AC 588 ms
50,240 KB
testcase_04 AC 600 ms
49,860 KB
testcase_05 WA -
testcase_06 AC 585 ms
49,264 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 592 ms
49,412 KB
testcase_10 AC 597 ms
50,076 KB
testcase_11 AC 588 ms
49,580 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    IO.read(:line)

    IO.read(:line)
    |> String.trim()
    |> String.split()
    |> solve
    |> IO.puts()
  end

  def solve(a) do
    a
    |> Enum.uniq()
    |> Enum.map(fn x ->
      a
      |> Enum.chunk_by(fn y -> y == x end)
      |> Enum.filter(fn y -> y |> hd != x end)
      |> Enum.map(&length/1)
      |> Enum.max(&>=/2, fn -> 0 end)
      |> (&(&1 + 1)).()
    end)
    |> Enum.max()
  end
end
0