結果

問題 No.90 品物の並び替え
ユーザー O2MT
提出日時 2020-10-23 00:55:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-07-21 09:41:34
合計ジャッジ時間 9,071 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 7 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations
N,M = map(int,input().split())
l = [[] for _ in range(N)]
ans = 0
for _ in range(M):
    i,y,s = map(int,input().split())
    l[i].append([y,s])
for perm in permutations(range(N)):
    perm = list(perm)
    now = 0
    for i in range(N):
        for item,score in l[i]:
            if item in perm[:i]:
                now += score
    ans = max(ans,now)
print(ans)
0