結果

問題 No.1285 ゴミ捨て
ユーザー thglafls
提出日時 2023-05-01 08:29:13
言語 F#
(F# 4.0)
結果
AC  
実行時間 385 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 8,489 ms
コンパイル使用メモリ 184,928 KB
実行使用メモリ 43,168 KB
最終ジャッジ日時 2024-11-20 09:09:42
合計ジャッジ時間 17,768 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (265 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

let calc (a: int[]) =
    let a_sorted = Array.append (Array.sort a) [| -1 |]
    let index = [| 1 .. a_sorted.Length - 1 |]

    if (Array.exists (fun x -> a_sorted.[x] - a_sorted.[x - 1] = 1) index) then
        2
    else
        1

let main =
    let n = stdin.ReadLine() |> int

    let e =
        [| for i = 0 to n - 1 do
               stdin.ReadLine() |> int |]

    printfn "%d" (calc e)
    0
0