結果

問題 No.90 品物の並び替え
ユーザー pasoconhoshiipasoconhoshii
提出日時 2019-02-11 15:26:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 401 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 77,212 KB
最終ジャッジ日時 2023-09-25 14:11:59
合計ジャッジ時間 9,345 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,188 KB
testcase_01 AC 578 ms
77,212 KB
testcase_02 AC 70 ms
71,488 KB
testcase_03 AC 103 ms
76,224 KB
testcase_04 AC 125 ms
76,824 KB
testcase_05 AC 658 ms
76,664 KB
testcase_06 AC 460 ms
76,960 KB
testcase_07 AC 80 ms
76,376 KB
testcase_08 AC 69 ms
71,140 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/mnt/c/Users/moiki/bash/env/bin/python
from itertools import permutations
N,M = map(int, input().split())
items = [ [ int(j) for j in input().split()] for _ in range(M)]


ans = 0
for perm in permutations([r for r in range(N)]):
    score = 0
    for m in range(M):
        if perm.index(items[m][0]) < perm.index(items[m][1]):
            score += items[m][2]
    ans = max(ans, score)

print(ans)
0