結果

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

ソースコード

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):
        print(s)
        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