結果
問題 | No.1285 ゴミ捨て |
ユーザー |
|
提出日時 | 2023-05-01 08:28:07 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 383 ms / 2,000 ms |
コード長 | 432 bytes |
コンパイル時間 | 15,879 ms |
コンパイル使用メモリ | 185,688 KB |
実行使用メモリ | 43,068 KB |
最終ジャッジ日時 | 2024-11-20 09:08:53 |
合計ジャッジ時間 | 21,820 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (562 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/
ソースコード
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