結果

問題 No.90 品物の並び替え
ユーザー shinshin
提出日時 2022-10-16 22:12:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 667 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 11,112 KB
最終ジャッジ日時 2023-09-09 23:28:56
合計ジャッジ時間 11,141 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,880 KB
testcase_01 AC 1,284 ms
11,008 KB
testcase_02 AC 16 ms
7,724 KB
testcase_03 AC 92 ms
8,156 KB
testcase_04 AC 148 ms
8,564 KB
testcase_05 AC 1,513 ms
11,060 KB
testcase_06 AC 1,024 ms
11,112 KB
testcase_07 AC 31 ms
7,800 KB
testcase_08 AC 15 ms
7,856 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

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