結果
問題 | No.1053 ゲーミング棒 |
ユーザー | ikd |
提出日時 | 2020-05-15 23:31:47 |
言語 | F# (F# 4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 985 bytes |
コンパイル時間 | 13,337 ms |
コンパイル使用メモリ | 191,004 KB |
実行使用メモリ | 36,532 KB |
最終ジャッジ日時 | 2023-10-19 17:31:22 |
合計ジャッジ時間 | 24,457 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 367 ms
36,492 KB |
testcase_01 | AC | 87 ms
32,580 KB |
testcase_02 | AC | 364 ms
36,492 KB |
testcase_03 | AC | 363 ms
36,504 KB |
testcase_04 | AC | 366 ms
36,528 KB |
testcase_05 | AC | 86 ms
32,572 KB |
testcase_06 | AC | 87 ms
32,580 KB |
testcase_07 | AC | 88 ms
32,572 KB |
testcase_08 | AC | 370 ms
36,492 KB |
testcase_09 | AC | 87 ms
32,572 KB |
testcase_10 | AC | 87 ms
32,572 KB |
testcase_11 | AC | 365 ms
36,496 KB |
testcase_12 | AC | 371 ms
36,496 KB |
testcase_13 | AC | 88 ms
32,580 KB |
testcase_14 | AC | 89 ms
32,580 KB |
testcase_15 | AC | 372 ms
36,492 KB |
testcase_16 | AC | 87 ms
32,580 KB |
testcase_17 | AC | 376 ms
36,492 KB |
testcase_18 | AC | 366 ms
36,492 KB |
testcase_19 | AC | 85 ms
32,572 KB |
testcase_20 | AC | 87 ms
32,580 KB |
testcase_21 | AC | 87 ms
32,580 KB |
testcase_22 | AC | 370 ms
36,532 KB |
testcase_23 | TLE | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (352 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: seq<int>) (seen: Set<int>) = match a |> Seq.tryHead with | None -> true | Some(x) -> if seen.Contains x then false else ok (a |> Seq.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.toSeq 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 |> Seq.skipWhile (fun y -> y = x)) (a |> Seq.takeWhile (fun y -> y = x)) ] |> Seq.concat printfn "%d" (if (ok b (new Set<int>([]))) then 1 else -1) 0 // return an integer exit code