結果
問題 | No.1053 ゲーミング棒 |
ユーザー | ikd |
提出日時 | 2020-05-16 00:04:13 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 560 ms / 2,000 ms |
コード長 | 966 bytes |
コンパイル時間 | 6,879 ms |
コンパイル使用メモリ | 191,096 KB |
実行使用メモリ | 70,520 KB |
最終ジャッジ日時 | 2023-10-19 18:29:51 |
合計ジャッジ時間 | 13,051 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 82 ms
32,304 KB |
testcase_01 | AC | 81 ms
32,620 KB |
testcase_02 | AC | 81 ms
32,304 KB |
testcase_03 | AC | 83 ms
32,300 KB |
testcase_04 | AC | 83 ms
32,300 KB |
testcase_05 | AC | 82 ms
32,616 KB |
testcase_06 | AC | 82 ms
32,620 KB |
testcase_07 | AC | 84 ms
32,616 KB |
testcase_08 | AC | 82 ms
32,312 KB |
testcase_09 | AC | 81 ms
32,616 KB |
testcase_10 | AC | 80 ms
32,620 KB |
testcase_11 | AC | 83 ms
32,304 KB |
testcase_12 | AC | 82 ms
32,304 KB |
testcase_13 | AC | 81 ms
32,616 KB |
testcase_14 | AC | 81 ms
32,616 KB |
testcase_15 | AC | 82 ms
32,312 KB |
testcase_16 | AC | 81 ms
32,616 KB |
testcase_17 | AC | 82 ms
32,304 KB |
testcase_18 | AC | 82 ms
32,288 KB |
testcase_19 | AC | 80 ms
32,616 KB |
testcase_20 | AC | 81 ms
32,616 KB |
testcase_21 | AC | 81 ms
32,616 KB |
testcase_22 | AC | 83 ms
32,304 KB |
testcase_23 | AC | 277 ms
66,732 KB |
testcase_24 | AC | 337 ms
66,796 KB |
testcase_25 | AC | 560 ms
70,020 KB |
testcase_26 | AC | 546 ms
70,520 KB |
testcase_27 | AC | 80 ms
32,612 KB |
testcase_28 | AC | 80 ms
32,620 KB |
testcase_29 | AC | 80 ms
32,612 KB |
testcase_30 | AC | 102 ms
41,412 KB |
testcase_31 | AC | 110 ms
44,644 KB |
testcase_32 | AC | 110 ms
44,640 KB |
testcase_33 | AC | 111 ms
44,648 KB |
testcase_34 | AC | 111 ms
44,648 KB |
testcase_35 | AC | 114 ms
45,720 KB |
testcase_36 | AC | 113 ms
45,820 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (236 ms)。 MSBuild のバージョン 17.7.3+8ec440e68 (.NET) main -> /home/judge/data/code/bin/Release/net7.0/main.dll main -> /home/judge/data/code/bin/Release/net7.0/publish/
ソースコード
// Learn more about F# at http://fsharp.org open System let rec ok (a: List<int>) (seen: Set<int>) = match a |> List.tryHead with | None -> true | Some(x) -> if seen.Contains x then false else ok (a |> List.skipWhile (fun y -> y = x)) (seen.Add x) [<EntryPoint>] let main argv = let n = stdin.ReadLine() |> int let a = stdin.ReadLine().Split() |> Array.map (fun x -> int (x) - 1) |> Array.toList if (ok a (new Set<int>([]))) then printfn "0" exit 0 let mutable freq = Array.create n 0 for x in a do freq.[x] <- freq.[x] + 1 match freq |> Array.tryFindIndex (fun v -> v >= 2) with | None -> printfn "0" | Some(x) -> let b = (a |> List.skipWhile (fun y -> y = x)) @ (a |> List.takeWhile (fun y -> y = x)) if (ok b (new Set<int>([]))) then printfn "1" else printfn "-1" 0 // return an integer exit code