結果

問題 No.1285 ゴミ捨て
ユーザー thglaflsthglafls
提出日時 2023-05-01 08:28:07
言語 F#
(F# 4.0)
結果
AC  
実行時間 385 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 10,014 ms
コンパイル使用メモリ 191,528 KB
実行使用メモリ 43,196 KB
最終ジャッジ日時 2024-04-30 13:53:42
合計ジャッジ時間 21,153 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 344 ms
35,508 KB
testcase_01 AC 347 ms
35,116 KB
testcase_02 AC 346 ms
35,248 KB
testcase_03 AC 347 ms
35,508 KB
testcase_04 AC 345 ms
34,488 KB
testcase_05 AC 347 ms
35,248 KB
testcase_06 AC 346 ms
35,372 KB
testcase_07 AC 381 ms
42,720 KB
testcase_08 AC 347 ms
35,292 KB
testcase_09 AC 363 ms
38,908 KB
testcase_10 AC 378 ms
41,868 KB
testcase_11 AC 375 ms
41,680 KB
testcase_12 AC 371 ms
39,200 KB
testcase_13 AC 369 ms
39,284 KB
testcase_14 AC 382 ms
42,472 KB
testcase_15 AC 372 ms
40,236 KB
testcase_16 AC 355 ms
37,436 KB
testcase_17 AC 358 ms
37,172 KB
testcase_18 AC 357 ms
37,144 KB
testcase_19 AC 363 ms
38,124 KB
testcase_20 AC 355 ms
36,940 KB
testcase_21 AC 357 ms
37,620 KB
testcase_22 AC 381 ms
43,096 KB
testcase_23 AC 385 ms
43,196 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (414 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 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