結果

問題 No.357 品物の並び替え (Middle)
ユーザー Snark86
提出日時 2016-04-01 23:56:18
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 322 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-10-02 10:06:45
合計ジャッジ時間 10,639 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import sys

lines = sys.stdin.readlines()
n = map(int,lines[0].split())
sl = [map(int,lines[i+1].split()) for i in range(n[1])]

best = 0
for i in itertools.permutations(range(n[0])):
	score = 0
	for s in sl:
		if i.index(s[0]) > i.index(s[1]):
			score += s[2]
	if score > best:
		best = score
print best
0