結果
| 問題 |
No.11 カードマッチ
|
| コンテスト | |
| ユーザー |
skewes
|
| 提出日時 | 2015-12-29 19:58:24 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 5,000 ms |
| コード長 | 1,342 bytes |
| コンパイル時間 | 2,183 ms |
| コンパイル使用メモリ | 106,112 KB |
| 実行使用メモリ | 20,096 KB |
| 最終ジャッジ日時 | 2024-10-11 19:59:19 |
| 合計ジャッジ時間 | 3,411 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace yukicoder
{
class _011
{
static void Main()
{
int w = int.Parse(Console.ReadLine());
int h = int.Parse(Console.ReadLine());
int n = int.Parse(Console.ReadLine());
int[][] skn = new int[n][];
for (int i = 0; i < n; i++)
{
skn[i] = Array.ConvertAll(Console.ReadLine().Split(' ')
, x => int.Parse(x));
}
int ans = 0;
HashSet<int> tw = new HashSet<int>();
HashSet<int> th = new HashSet<int>();
for (int i = 0; i < n; i++)
{
int sn = skn[i][0] - 1;
int kn = skn[i][1] - 1;
if (tw.Contains(sn) && th.Contains(kn))
{
ans--;
continue;
}
if (!tw.Contains(sn))
{
ans += h - th.Count - 1;
}
if (!th.Contains(kn))
{
ans += w - tw.Count - 1;
}
tw.Add(sn);
th.Add(kn);
}
Console.WriteLine(ans);
}
}
}
skewes