結果
問題 | No.1053 ゲーミング棒 |
ユーザー | ikd |
提出日時 | 2020-05-15 23:27:19 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 900 ms / 2,000 ms |
コード長 | 961 bytes |
コンパイル時間 | 7,810 ms |
コンパイル使用メモリ | 190,876 KB |
実行使用メモリ | 74,912 KB |
最終ジャッジ日時 | 2023-10-19 17:21:33 |
合計ジャッジ時間 | 19,572 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 360 ms
36,644 KB |
testcase_01 | AC | 83 ms
32,740 KB |
testcase_02 | AC | 360 ms
36,640 KB |
testcase_03 | AC | 360 ms
36,636 KB |
testcase_04 | AC | 363 ms
36,640 KB |
testcase_05 | AC | 86 ms
32,748 KB |
testcase_06 | AC | 85 ms
32,736 KB |
testcase_07 | AC | 85 ms
32,748 KB |
testcase_08 | AC | 363 ms
36,640 KB |
testcase_09 | AC | 86 ms
32,748 KB |
testcase_10 | AC | 86 ms
32,740 KB |
testcase_11 | AC | 360 ms
36,640 KB |
testcase_12 | AC | 361 ms
36,640 KB |
testcase_13 | AC | 87 ms
32,740 KB |
testcase_14 | AC | 85 ms
32,740 KB |
testcase_15 | AC | 361 ms
36,640 KB |
testcase_16 | AC | 86 ms
32,740 KB |
testcase_17 | AC | 361 ms
36,640 KB |
testcase_18 | AC | 365 ms
36,604 KB |
testcase_19 | AC | 86 ms
32,748 KB |
testcase_20 | AC | 86 ms
32,748 KB |
testcase_21 | AC | 85 ms
32,748 KB |
testcase_22 | AC | 359 ms
36,640 KB |
testcase_23 | AC | 294 ms
66,912 KB |
testcase_24 | AC | 374 ms
66,980 KB |
testcase_25 | AC | 899 ms
74,552 KB |
testcase_26 | AC | 900 ms
74,912 KB |
testcase_27 | AC | 85 ms
32,748 KB |
testcase_28 | AC | 84 ms
32,744 KB |
testcase_29 | AC | 84 ms
32,740 KB |
testcase_30 | AC | 108 ms
41,592 KB |
testcase_31 | AC | 392 ms
49,016 KB |
testcase_32 | AC | 395 ms
49,012 KB |
testcase_33 | AC | 396 ms
49,024 KB |
testcase_34 | AC | 396 ms
49,024 KB |
testcase_35 | AC | 399 ms
50,096 KB |
testcase_36 | AC | 394 ms
50,192 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (262 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)) printfn "%d" (if (ok b (new Set<int>([]))) then 1 else -1) 0 // return an integer exit code