結果

問題 No.90 品物の並び替え
ユーザー shin
提出日時 2022-10-16 22:12:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 667 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 43,040 KB
最終ジャッジ日時 2024-06-27 15:54:52
合計ジャッジ時間 11,627 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#品物の並び替え

def alllist(text , num_list):
    if len(num_list) == 1:
        text += str(num_list[0])
        all_list.append(text)
    else:
        for i in num_list:
            text2 = text + str(i)
            copy = num_list.copy()
            copy.remove(i)
            alllist(text2 , copy)


N , M = map(int , input().split())

score = []
for i in range(M):
    score.append(list(map(int , input().split())))

all_list = []
r = [i for i in range(N)]

alllist("" , r)

total = 0

for t in all_list:
    sum = 0
    for s in score:
        if t.find(str(s[0])) < t.find(str(s[1])):
            sum += s[2]
    total = max(total , sum)

print(total)
0