結果

問題 No.11 カードマッチ
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-27 09:46:53
言語 C#
(.NET 8.0.203)
結果
RE  
実行時間 -
コード長 1,098 bytes
コンパイル時間 9,725 ms
コンパイル使用メモリ 169,876 KB
実行使用メモリ 568,308 KB
最終ジャッジ日時 2024-04-14 22:25:30
合計ジャッジ時間 15,821 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
30,464 KB
testcase_01 AC 54 ms
29,824 KB
testcase_02 AC 55 ms
30,208 KB
testcase_03 AC 55 ms
30,336 KB
testcase_04 RE -
testcase_05 AC 55 ms
30,336 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 131 ms
55,764 KB
testcase_16 AC 648 ms
258,016 KB
testcase_17 AC 282 ms
109,780 KB
testcase_18 MLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (92 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 #

using System;
using System.Collections.Generic;
using System.Linq;

namespace yukicoder
{
	public class Program
	{
		public static void Main()
		{
			var h = int.Parse(Console.ReadLine());
			var w = int.Parse(Console.ReadLine());
			var n = int.Parse(Console.ReadLine());
			var s = new bool[h, w, 2];
			long sum = 0;
			for (var i = 0; i < n; i++){
				var a = Console.ReadLine().Split(' ').Select(value => int.Parse(value) - 1).ToArray();
				for(var j = 0; j < w; j++)
                {
                    if (!s[a[0], j, 1])
                    {
						s[a[0], j, 0] = true;
					}
                }
				for(var j = 0; j < h; j++)
                {
                    if (!s[j, a[1], 1])
                    {
						s[j, a[1], 0] = true;
					}
                }
				s[a[0], a[1], 1] = true;
				s[a[0], a[1], 0] = false;
			}
			for(var i = 0; i < h; i++)
            {
				for(var j = 0; j < w; j++)
                {
                    if (s[i, j, 0])
                    {
						sum++;
                    }
                }
            }
			Console.WriteLine(sum);
        }
    }
}
0