結果

問題 No.2178 Payable Magic Items
ユーザー ニックネーム
提出日時 2023-01-06 23:42:06
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 341 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 174,400 KB
最終ジャッジ日時 2024-12-14 18:10:09
合計ジャッジ時間 10,313 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
a = sorted(input() for _ in range(n))
x = set()
for s in a[::-1]:
    y = set()
    for t in x:
        f = g = False
        for i in range(k):
            if s[i]>t[i]: f = True
            if s[i]<t[i]: g = True
        if not f: break
        if not g: y.add(t)
    else: x.add(s)
    x -=y
print(n-len(x))
0