結果

問題 No.1479 Matrix Eraser
ユーザー さかぽんさかぽん
提出日時 2021-04-16 21:56:20
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 715 bytes
コンパイル時間 2,556 ms
コンパイル使用メモリ 107,896 KB
実行使用メモリ 135,528 KB
最終ジャッジ日時 2023-09-16 00:31:14
合計ジャッジ時間 13,911 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
22,764 KB
testcase_01 AC 65 ms
22,540 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 105 ms
39,456 KB
testcase_08 AC 150 ms
50,140 KB
testcase_09 AC 254 ms
72,132 KB
testcase_10 AC 443 ms
111,288 KB
testcase_11 AC 272 ms
77,220 KB
testcase_12 AC 118 ms
39,292 KB
testcase_13 AC 157 ms
52,476 KB
testcase_14 AC 136 ms
42,636 KB
testcase_15 AC 80 ms
27,520 KB
testcase_16 AC 136 ms
46,784 KB
testcase_17 AC 498 ms
117,592 KB
testcase_18 AC 504 ms
118,984 KB
testcase_19 AC 497 ms
120,860 KB
testcase_20 AC 496 ms
120,512 KB
testcase_21 AC 497 ms
120,088 KB
testcase_22 AC 500 ms
120,812 KB
testcase_23 AC 514 ms
120,024 KB
testcase_24 AC 498 ms
119,096 KB
testcase_25 AC 496 ms
120,116 KB
testcase_26 AC 504 ms
121,844 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 149 ms
27,324 KB
testcase_33 AC 150 ms
29,352 KB
testcase_34 AC 150 ms
25,336 KB
testcase_35 AC 150 ms
27,276 KB
testcase_36 AC 150 ms
27,588 KB
testcase_37 AC 118 ms
29,308 KB
testcase_38 AC 209 ms
49,900 KB
testcase_39 AC 476 ms
135,528 KB
testcase_40 AC 63 ms
22,604 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;

class D
{
	static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
	static (int, int) Read2() { var a = Read(); return (a[0], a[1]); }
	static void Main()
	{
		var (h, w) = Read2();
		var a = Array.ConvertAll(new bool[h], _ => Read());

		var d = new Dictionary<int, (HashSet<int> r, HashSet<int> c)>();

		for (int i = 0; i < h; i++)
		{
			for (int j = 0; j < w; j++)
			{
				var k = a[i][j];
				if (k == 0) continue;

				if (!d.ContainsKey(k)) d[k] = (new HashSet<int>(), new HashSet<int>());
				d[k].r.Add(i);
				d[k].c.Add(j);
			}
		}
		Console.WriteLine(d.Values.Sum(t => Math.Min(t.r.Count, t.c.Count)));
	}
}
0