結果

問題 No.1285 ゴミ捨て
ユーザー thglaflsthglafls
提出日時 2023-05-01 08:29:13
言語 F#
(F# 4.0)
結果
AC  
実行時間 380 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 6,677 ms
コンパイル使用メモリ 191,016 KB
実行使用メモリ 43,284 KB
最終ジャッジ日時 2024-04-30 13:54:30
合計ジャッジ時間 16,657 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 342 ms
35,304 KB
testcase_01 AC 341 ms
35,156 KB
testcase_02 AC 347 ms
35,496 KB
testcase_03 AC 344 ms
35,352 KB
testcase_04 AC 338 ms
34,996 KB
testcase_05 AC 340 ms
35,300 KB
testcase_06 AC 340 ms
35,460 KB
testcase_07 AC 373 ms
42,176 KB
testcase_08 AC 343 ms
35,612 KB
testcase_09 AC 359 ms
38,904 KB
testcase_10 AC 372 ms
41,976 KB
testcase_11 AC 372 ms
41,412 KB
testcase_12 AC 363 ms
40,072 KB
testcase_13 AC 361 ms
39,828 KB
testcase_14 AC 372 ms
42,712 KB
testcase_15 AC 366 ms
39,312 KB
testcase_16 AC 355 ms
37,248 KB
testcase_17 AC 355 ms
37,148 KB
testcase_18 AC 357 ms
37,056 KB
testcase_19 AC 361 ms
38,724 KB
testcase_20 AC 355 ms
37,072 KB
testcase_21 AC 355 ms
37,608 KB
testcase_22 AC 380 ms
42,500 KB
testcase_23 AC 377 ms
43,284 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (226 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