結果

問題 No.723 2つの数の和
ユーザー taktak
提出日時 2019-02-22 20:04:39
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 426 bytes
コンパイル時間 7,803 ms
コンパイル使用メモリ 157,340 KB
実行使用メモリ 47,464 KB
最終ジャッジ日時 2023-08-16 11:56:36
合計ジャッジ時間 9,292 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
22,400 KB
testcase_01 AC 74 ms
22,384 KB
testcase_02 AC 75 ms
22,532 KB
testcase_03 AC 235 ms
45,604 KB
testcase_04 AC 271 ms
45,132 KB
testcase_05 AC 253 ms
41,052 KB
testcase_06 AC 264 ms
43,460 KB
testcase_07 AC 173 ms
35,836 KB
testcase_08 AC 184 ms
39,056 KB
testcase_09 AC 287 ms
45,268 KB
testcase_10 AC 168 ms
35,540 KB
testcase_11 AC 102 ms
31,932 KB
testcase_12 AC 196 ms
41,652 KB
testcase_13 AC 278 ms
45,536 KB
testcase_14 AC 136 ms
34,600 KB
testcase_15 AC 173 ms
36,248 KB
testcase_16 AC 219 ms
43,896 KB
testcase_17 AC 257 ms
43,632 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 74 ms
22,444 KB
testcase_21 AC 73 ms
20,404 KB
testcase_22 AC 74 ms
22,576 KB
testcase_23 AC 307 ms
47,464 KB
testcase_24 AC 146 ms
35,616 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System

let solve a x =
  let countMap = 
    a |> Array.countBy id
    |> Map.ofArray
  let countMapSeq = countMap |> Map.toSeq

  countMapSeq |> Seq.map(fun (k, v) ->
    let k' = x - k
    countMap.TryFind k' |> function
    | None -> 0
    | Some c -> v * c)
  |> Seq.sum  

let R() = Console.ReadLine().Split() |> Array.map int64

let N, X = 
  let t = R()
  t.[0], t.[1]

let a = R()

solve a X
|> Console.WriteLine
0