結果

問題 No.1285 ゴミ捨て
コンテスト
ユーザー thglafls
提出日時 2023-05-01 08:28:07
言語 F#
(F# 10.0)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 432 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,588 ms
コンパイル使用メモリ 208,168 KB
実行使用メモリ 43,112 KB
最終ジャッジ日時 2026-05-14 10:55:02
合計ジャッジ時間 16,210 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (272 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

let calc (a: int[]) =
    let parity = a.[0] &&& 1
    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