結果
問題 | No.1072 A Nice XOR Pair |
ユーザー | ikd |
提出日時 | 2020-06-06 12:02:32 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 833 ms / 2,000 ms |
コード長 | 645 bytes |
コンパイル時間 | 5,964 ms |
コンパイル使用メモリ | 165,392 KB |
実行使用メモリ | 63,540 KB |
最終ジャッジ日時 | 2023-08-25 00:20:32 |
合計ジャッジ時間 | 11,003 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 92 ms
23,172 KB |
testcase_01 | AC | 92 ms
20,988 KB |
testcase_02 | AC | 93 ms
23,132 KB |
testcase_03 | AC | 90 ms
23,144 KB |
testcase_04 | AC | 91 ms
25,188 KB |
testcase_05 | AC | 90 ms
21,160 KB |
testcase_06 | AC | 95 ms
23,020 KB |
testcase_07 | AC | 833 ms
62,968 KB |
testcase_08 | AC | 254 ms
37,168 KB |
testcase_09 | AC | 231 ms
35,256 KB |
testcase_10 | AC | 397 ms
35,968 KB |
testcase_11 | AC | 719 ms
61,456 KB |
testcase_12 | AC | 828 ms
63,540 KB |
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0 Copyright (c) Microsoft Corporation. All Rights Reserved. /home/judge/data/code/Main.fs(12,9): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _|]' may indicate a case not covered by the pattern(s).
ソースコード
// Learn more about F# at http://fsharp.org open System let get (map: Map<int, int64>) (key: int) = match map.TryFind key with | Some f -> f | None -> 0L [<EntryPoint>] let main argv = let [| n; x |] = stdin.ReadLine().Split() |> Array.map int let a = [ for i in 1 .. n -> stdin.ReadLine() |> int ] let res = a |> List.fold (fun (freq: Map<int, int64>, ans) y -> let z = x ^^^ y let zf = get freq z let yf = get freq y freq.Add(y, yf + 1L), ans + zf) (Map.empty, 0L) res |> snd |> printfn "%d" 0 // return an integer exit code