結果

問題 No.90 品物の並び替え
コンテスト
ユーザー
提出日時 2023-04-13 13:57:17
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 395 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 59 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 416,256 KB
最終ジャッジ日時 2026-09-12 14:18:52
合計ジャッジ時間 13,340 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 7 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import math
import itertools

N,M=map(int,input().split())
s=[[0,0,0]]+[list(map(int,input().split())) for _ in range(M)]
n=math.factorial(N)
l=list(itertools.permutations(range(N)))
d=[[0 for _ in range(n)] for _ in range(M+1)]

for i in range(1,M+1):
    for j in range(n):
        if list(l[j]).index(s[i][0])<list(l[j]).index(s[i][1]):
            d[i][j]=d[i-1][j]+s[i][2]

print(max(d[M]))
0