結果

問題 No.11 カードマッチ
ユーザー skewesskewes
提出日時 2015-12-29 19:58:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 1,342 bytes
コンパイル時間 1,151 ms
コンパイル使用メモリ 114,296 KB
実行使用メモリ 27,976 KB
最終ジャッジ日時 2024-04-20 01:10:57
合計ジャッジ時間 2,528 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
25,672 KB
testcase_01 AC 25 ms
25,952 KB
testcase_02 AC 26 ms
25,904 KB
testcase_03 AC 28 ms
26,060 KB
testcase_04 AC 26 ms
27,976 KB
testcase_05 AC 27 ms
26,440 KB
testcase_06 AC 26 ms
25,808 KB
testcase_07 AC 26 ms
23,860 KB
testcase_08 AC 25 ms
27,868 KB
testcase_09 AC 28 ms
25,712 KB
testcase_10 AC 25 ms
25,932 KB
testcase_11 AC 26 ms
27,880 KB
testcase_12 AC 27 ms
26,060 KB
testcase_13 AC 25 ms
26,032 KB
testcase_14 AC 26 ms
25,936 KB
testcase_15 AC 25 ms
26,064 KB
testcase_16 AC 27 ms
27,968 KB
testcase_17 AC 27 ms
26,036 KB
testcase_18 AC 27 ms
25,936 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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);
        }
    }
}
0