結果

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

ソースコード

diff #

n,k = map(int,input().split())
a = sorted([input() for _ in range(n)],reverse=True)
x = set()
for s in a:
    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