結果

問題 No.11 カードマッチ
ユーザー むらためむらため
提出日時 2017-07-30 23:54:51
言語 Nim
(2.0.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 644 bytes
コンパイル時間 935 ms
コンパイル使用メモリ 68,388 KB
最終ジャッジ日時 2024-04-27 02:28:28
合計ジャッジ時間 1,296 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 50) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated]
/home/judge/data/code/Main.nim(1, 62) Error: cannot open file: queues

ソースコード

diff #

import sequtils,strutils,strscans,algorithm,math,future,sets,queues,tables
template get():string = stdin.readLine()
template times(n:int,body:untyped): untyped = (for _ in 0..<n: body)

let
  W = get().parseInt
  H = get().parseInt
  N = get().parseInt
var
  cards = newSeq[tuple[x:int,y:int]](0)
  res = 0
  w_left = W
  h_left = H

N.times:
  var x,y = 0
  (x,y) = get().split().map(parseInt)
  let
    x_new = cards.allIt(it.x != x)
    y_new = cards.allIt(it.y != y)
  if not (x_new and y_new): res -= 1 # 被り
  if x_new: w_left -= 1
  if y_new: h_left -= 1
  if x_new: res += h_left
  if y_new: res += w_left
  cards.add((x,y))
echo res
0