結果

問題 No.90 品物の並び替え
ユーザー lllllll88938494
提出日時 2022-03-14 05:36:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 380 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,376 KB
最終ジャッジ日時 2024-09-19 14:57:41
合計ジャッジ時間 8,850 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

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