結果

問題 No.11 カードマッチ
ユーザー pocaristpocarist
提出日時 2015-09-24 17:11:26
言語 F#
(F# 4.0)
結果
RE  
実行時間 -
コード長 842 bytes
コンパイル時間 14,014 ms
コンパイル使用メモリ 206,092 KB
実行使用メモリ 36,748 KB
最終ジャッジ日時 2024-07-19 09:00:41
合計ジャッジ時間 20,407 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 2 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (402 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/

ソースコード

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