結果

問題 No.90 品物の並び替え
ユーザー lllllll88938494lllllll88938494
提出日時 2022-03-14 05:36:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 380 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 11,960 KB
実行使用メモリ 10,104 KB
最終ジャッジ日時 2023-10-19 18:40:15
合計ジャッジ時間 10,223 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,100 KB
testcase_01 AC 691 ms
10,104 KB
testcase_02 AC 29 ms
10,100 KB
testcase_03 AC 75 ms
10,100 KB
testcase_04 AC 98 ms
10,104 KB
testcase_05 AC 810 ms
10,104 KB
testcase_06 AC 569 ms
10,104 KB
testcase_07 AC 37 ms
10,100 KB
testcase_08 AC 28 ms
10,100 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations as per
n,m=map(int,input().split())
ms=[list(map(int,input().split())) for i in range(m)]
ans=0
for p in per(range(n)):
    dic={}
    for i in range(n):
        dic[p[i]] = i
    point=0
    for j in range(m):
        a,b,c=ms[j]
        if dic[a] < dic[b]:
            point+=c
            
    ans=max(ans,point)
    
print(ans)
            
0