結果

問題 No.1479 Matrix Eraser
ユーザー さかぽんさかぽん
提出日時 2021-04-16 21:58:05
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 721 bytes
コンパイル時間 2,281 ms
コンパイル使用メモリ 106,764 KB
実行使用メモリ 131,384 KB
最終ジャッジ日時 2023-09-16 00:35:39
合計ジャッジ時間 13,578 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
22,808 KB
testcase_01 AC 63 ms
24,704 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 100 ms
41,512 KB
testcase_08 AC 141 ms
50,792 KB
testcase_09 AC 226 ms
75,000 KB
testcase_10 AC 397 ms
110,844 KB
testcase_11 AC 250 ms
77,264 KB
testcase_12 AC 111 ms
36,860 KB
testcase_13 AC 144 ms
50,280 KB
testcase_14 AC 127 ms
42,440 KB
testcase_15 AC 78 ms
25,400 KB
testcase_16 AC 130 ms
46,752 KB
testcase_17 AC 466 ms
121,628 KB
testcase_18 AC 458 ms
119,108 KB
testcase_19 AC 455 ms
120,532 KB
testcase_20 AC 459 ms
119,528 KB
testcase_21 AC 460 ms
118,588 KB
testcase_22 AC 456 ms
118,364 KB
testcase_23 AC 464 ms
116,552 KB
testcase_24 AC 466 ms
120,540 KB
testcase_25 AC 461 ms
118,996 KB
testcase_26 AC 460 ms
122,104 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 148 ms
27,108 KB
testcase_33 AC 148 ms
29,220 KB
testcase_34 AC 150 ms
27,200 KB
testcase_35 AC 148 ms
27,160 KB
testcase_36 AC 149 ms
29,276 KB
testcase_37 AC 116 ms
25,144 KB
testcase_38 AC 196 ms
45,824 KB
testcase_39 AC 449 ms
131,384 KB
testcase_40 AC 62 ms
22,688 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 => (long)Math.Min(t.r.Count, t.c.Count)));
	}
}
0