結果
問題 | No.723 2つの数の和 |
ユーザー | tak |
提出日時 | 2019-02-27 16:26:52 |
言語 | F# (F# 4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,754 bytes |
コンパイル時間 | 13,951 ms |
コンパイル使用メモリ | 187,904 KB |
実行使用メモリ | 67,948 KB |
最終ジャッジ日時 | 2024-06-23 05:15:44 |
合計ジャッジ時間 | 19,254 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 56 ms
30,336 KB |
testcase_01 | AC | 55 ms
30,336 KB |
testcase_02 | AC | 57 ms
30,336 KB |
testcase_03 | AC | 268 ms
63,232 KB |
testcase_04 | AC | 278 ms
63,616 KB |
testcase_05 | AC | 260 ms
63,220 KB |
testcase_06 | AC | 264 ms
63,488 KB |
testcase_07 | AC | 170 ms
58,356 KB |
testcase_08 | AC | 179 ms
58,752 KB |
testcase_09 | AC | 279 ms
63,488 KB |
testcase_10 | AC | 170 ms
58,752 KB |
testcase_11 | AC | 78 ms
36,608 KB |
testcase_12 | AC | 198 ms
62,680 KB |
testcase_13 | AC | 272 ms
63,744 KB |
testcase_14 | AC | 125 ms
50,176 KB |
testcase_15 | AC | 174 ms
58,624 KB |
testcase_16 | AC | 215 ms
62,976 KB |
testcase_17 | AC | 250 ms
63,104 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 56 ms
30,196 KB |
testcase_21 | AC | 58 ms
30,464 KB |
testcase_22 | AC | 58 ms
30,336 KB |
testcase_23 | AC | 352 ms
67,948 KB |
testcase_24 | AC | 139 ms
53,760 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (291 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
open System open System.Text type IO() = let size = 1 <<< 12 let stream = Console.OpenStandardInput() let buffer = Array.zeroCreate size let ``!`` = byte '!' let ``~`` = byte '~' let mutable bufferPtr = 0 let hasNextByte = let mutable bufferLen = 0 fun () -> if bufferPtr < bufferLen then true else bufferPtr <- 0 bufferLen <- stream.Read(buffer, 0, size) bufferLen > 0 let readByte() = if hasNextByte() then let r = buffer.[bufferPtr] bufferPtr <- bufferPtr + 1 r else failwith "error" let isAscii c = ``!`` <= c && c <= ``~`` let nextCharByte() = let rec f() = let b = readByte() if isAscii b then b else f() f() let next() = let rec f (sb: StringBuilder) = let c = match sb.Length with | 0 -> nextCharByte() | _ -> readByte() if isAscii c then c |> char |> sb.Append |> f else sb f <| new StringBuilder() |> fun x -> x.ToString() member __.string() = next() member __.char() = nextCharByte() |> char member __.int() = next() |> int member __.int64() = next() |> int64 member __.float() = next() |> float let solve a x = let count = a |> Array.countBy id let countKey = count |> Array.map fst let countMap = count |> Map.ofArray let pairNum key1 = let val1 = countMap.[key1] let key2 = x - key1 Map.tryFind key2 countMap |> function | Some val2 -> val1 * val2 | None -> 0 countKey |> Array.map pairNum |> Array.sum let io = new IO() let N, X = let a = io.int() let b = io.int() a, b let a = let t = Array.zeroCreate N for i in 0 .. (N - 1) do t.[i] <- io.int() t solve a X |> Console.WriteLine