結果

問題 No.11 カードマッチ
ユーザー pocaristpocarist
提出日時 2015-09-24 17:11:26
言語 F#
(F# 4.0)
結果
RE  
実行時間 -
コード長 842 bytes
コンパイル時間 5,525 ms
コンパイル使用メモリ 160,124 KB
実行使用メモリ 26,360 KB
最終ジャッジ日時 2023-09-26 14:49:39
合計ジャッジ時間 7,959 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
24,928 KB
testcase_01 AC 82 ms
22,764 KB
testcase_02 AC 83 ms
22,896 KB
testcase_03 AC 84 ms
22,760 KB
testcase_04 RE -
testcase_05 AC 85 ms
22,844 KB
testcase_06 AC 90 ms
26,360 KB
testcase_07 AC 83 ms
23,072 KB
testcase_08 AC 84 ms
25,380 KB
testcase_09 AC 87 ms
24,384 KB
testcase_10 AC 86 ms
23,836 KB
testcase_11 AC 88 ms
23,792 KB
testcase_12 AC 87 ms
25,840 KB
testcase_13 AC 86 ms
23,816 KB
testcase_14 RE -
testcase_15 WA -
testcase_16 AC 83 ms
22,824 KB
testcase_17 AC 82 ms
22,776 KB
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

// http://yukicoder.me/problems/30

open System

let dprintfn fmt = Printf.kprintf Diagnostics.Debug.WriteLine fmt

[<EntryPoint>]
let main argv = 
    let W = Console.ReadLine().Trim() |> int
    let H = Console.ReadLine().Trim() |> int
    let N = Console.ReadLine().Trim() |> int
    let suits = Array.create (W) false
    let nums = Array.create (H) false
    let w = ref 0
    let h = ref 0
    for i=1 to N do
        let S, K = Console.ReadLine().Trim().Split([|' '|]) |> Array.map int |> fun a -> a.[0]-1, a.[1]-1
        if suits.[S] = false then
            incr w
            suits.[S] <- true
        if nums.[K] = false then 
            incr h
            nums.[S] <- true
    let W = int64 W
    let H = int64 H
    let w = int64 !w
    let h = int64 !h
    let ans = W*H - (W - w)*(H - h) - int64 N
    printfn "%d" ans
    0
0