結果

問題 No.1479 Matrix Eraser
ユーザー 小野寺健小野寺健
提出日時 2021-04-27 17:51:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 522 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 37,616 KB
最終ジャッジ日時 2023-09-20 18:27:00
合計ジャッジ時間 8,822 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,932 KB
testcase_01 AC 15 ms
7,832 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 16 ms
7,844 KB
testcase_06 AC 16 ms
7,892 KB
testcase_07 AC 157 ms
11,216 KB
testcase_08 AC 355 ms
13,596 KB
testcase_09 AC 1,375 ms
20,268 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())

S = []

for i in range(H):
    for j, a in enumerate(list(map(int, input().split()))):
        if a > 0:
            S.append((a, i, j))
            
S.sort(reverse=True)

cnt = 0
while len(S) > 0:
    a, i, j = S.pop(0)
    ai = []
    aj = []
    for b in S:
        if b[0] != a:
            break
        if i == b[1]:
            ai.append(b)
        elif j == b[2]:
            aj.append(b)
    for b in ai if len(ai) >= len(aj) else aj:
        S.remove(b)
    cnt += 1

print(cnt)
0