結果

問題 No.1479 Matrix Eraser
ユーザー startcppstartcpp
提出日時 2021-04-16 20:41:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 685 ms
コンパイル使用メモリ 74,136 KB
実行使用メモリ 74,908 KB
最終ジャッジ日時 2023-09-15 21:43:18
合計ジャッジ時間 7,409 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
50,604 KB
testcase_01 AC 20 ms
50,408 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 41 ms
53,688 KB
testcase_08 AC 57 ms
55,720 KB
testcase_09 AC 104 ms
61,020 KB
testcase_10 AC 196 ms
70,436 KB
testcase_11 AC 121 ms
62,808 KB
testcase_12 AC 46 ms
54,004 KB
testcase_13 AC 56 ms
55,472 KB
testcase_14 AC 47 ms
54,164 KB
testcase_15 AC 27 ms
51,256 KB
testcase_16 AC 52 ms
54,784 KB
testcase_17 AC 241 ms
74,664 KB
testcase_18 AC 247 ms
74,624 KB
testcase_19 AC 238 ms
74,908 KB
testcase_20 AC 243 ms
74,620 KB
testcase_21 AC 235 ms
74,580 KB
testcase_22 AC 235 ms
74,732 KB
testcase_23 AC 237 ms
74,664 KB
testcase_24 AC 241 ms
74,580 KB
testcase_25 AC 235 ms
74,592 KB
testcase_26 AC 235 ms
74,812 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 76 ms
51,316 KB
testcase_33 AC 77 ms
51,384 KB
testcase_34 AC 78 ms
51,316 KB
testcase_35 AC 76 ms
51,320 KB
testcase_36 AC 77 ms
51,360 KB
testcase_37 AC 75 ms
51,268 KB
testcase_38 AC 250 ms
74,664 KB
testcase_39 AC 183 ms
74,884 KB
testcase_40 AC 22 ms
50,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <set>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int h, w;
int a[500][500];
set<int> rows[500001];
set<int> cols[500001];

signed main() {
	int i, j;
	
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			cin >> a[i][j];
			rows[a[i][j]].insert(i);
			cols[a[i][j]].insert(j);
		}
	}
	
	int jyokai = 0;
	rep(i, 500001) {
		if (i == 0) continue;
		jyokai += min(rows[i].size(), cols[i].size());
	}
	cout << jyokai << endl;
	return 0;
}
0