結果

問題 No.2178 Payable Magic Items
ユーザー FromBooskaFromBooska
提出日時 2023-06-08 12:42:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 847 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 106,880 KB
最終ジャッジ日時 2023-08-29 01:53:44
合計ジャッジ時間 8,798 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,408 KB
testcase_01 AC 72 ms
71,072 KB
testcase_02 AC 69 ms
71,312 KB
testcase_03 AC 68 ms
71,180 KB
testcase_04 AC 69 ms
71,016 KB
testcase_05 AC 69 ms
71,120 KB
testcase_06 AC 68 ms
71,176 KB
testcase_07 AC 70 ms
71,184 KB
testcase_08 AC 68 ms
71,192 KB
testcase_09 AC 66 ms
71,444 KB
testcase_10 AC 69 ms
71,252 KB
testcase_11 WA -
testcase_12 AC 362 ms
91,260 KB
testcase_13 WA -
testcase_14 AC 365 ms
90,776 KB
testcase_15 AC 374 ms
91,640 KB
testcase_16 AC 367 ms
91,288 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 152 ms
81,276 KB
testcase_20 AC 77 ms
76,428 KB
testcase_21 AC 97 ms
76,636 KB
testcase_22 AC 93 ms
76,844 KB
testcase_23 AC 80 ms
76,632 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 166 ms
81,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# K<8だが8次元dpはないな
# 0<=Sij<=4と非常に小さい
# ということは5**8=40000の組み合わせしかない
# bit dpはありえるか、ただしバイナリでなく5進数なので難しい
# グラフ化
# 数字と見なして降順ソート
# 大きい方から見ていって、いずれかのSijにおいて最大なら残す

N, K = map(int, input().split())
S = []
for i in range(N):
    S.append(input())
S.sort(reverse = True)


remaining = set()
remaining.add(S[0])
for i in range(1, N):
    s = S[i]
    test = False
    for r in remaining:
        if test == True:
            break
        
        for j in range(K):
            if int(s[j]) > int(r[j]):
                test = True
                break
    if test == True:
        remaining.add(s)

#print(remaining)

ans = N - len(remaining)
print(ans)




0