結果
問題 |
No.1479 Matrix Eraser
|
ユーザー |
|
提出日時 | 2021-04-16 21:56:20 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 715 bytes |
コンパイル時間 | 1,009 ms |
コンパイル使用メモリ | 108,288 KB |
実行使用メモリ | 131,232 KB |
最終ジャッジ日時 | 2024-07-03 01:38:56 |
合計ジャッジ時間 | 11,353 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 29 WA * 10 |
コンパイルメッセージ
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; 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))); } }