結果

問題 No.2178 Payable Magic Items
ユーザー FromBooskaFromBooska
提出日時 2023-06-08 13:02:31
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 899 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 96,220 KB
最終ジャッジ日時 2023-08-29 02:36:14
合計ジャッジ時間 7,495 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,120 KB
testcase_01 AC 67 ms
71,328 KB
testcase_02 AC 67 ms
71,140 KB
testcase_03 AC 67 ms
71,328 KB
testcase_04 AC 67 ms
71,160 KB
testcase_05 AC 70 ms
71,276 KB
testcase_06 AC 69 ms
71,268 KB
testcase_07 AC 68 ms
71,276 KB
testcase_08 AC 69 ms
71,268 KB
testcase_09 AC 68 ms
71,528 KB
testcase_10 AC 66 ms
71,324 KB
testcase_11 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

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])
#print(remaining)
for i in range(1, N):
    s = S[i]
    test = True
    for r in remaining:
        subtest = False
        for j in range(K):
            if int(s[j]) > int(r[j]):
                subtest = True
        if subtest == False:
            test = False

    if test == True:
        remaining.add(s)
    #print('s', s, remaining)

#print(remaining)

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


0