結果

問題 No.90 品物の並び替え
ユーザー 👑 KazunKazun
提出日時 2020-10-14 16:10:48
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 305 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 81,740 KB
最終ジャッジ日時 2023-09-28 00:38:27
合計ジャッジ時間 9,164 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,296 KB
testcase_01 AC 544 ms
76,528 KB
testcase_02 AC 63 ms
71,388 KB
testcase_03 AC 96 ms
76,020 KB
testcase_04 AC 115 ms
76,492 KB
testcase_05 AC 613 ms
76,508 KB
testcase_06 AC 436 ms
76,664 KB
testcase_07 AC 76 ms
76,352 KB
testcase_08 AC 64 ms
71,204 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N,M=map(int,input().split())
X=[0]*M
for i in range(M):
    x,y,a=map(int,input().split())
    X[i]=(x,y,a)

Max=-1
for U in permutations(range(N)):
    T=0
    for (x,y,a) in X:
        if U.index(x)<U.index(y):
            T+=a

    if T>Max:
        Max=T
print(Max)
0