結果

問題 No.90 品物の並び替え
ユーザー bellangeldindon
提出日時 2019-05-08 16:05:34
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 594 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 14,208 KB
最終ジャッジ日時 2024-07-02 00:28:58
合計ジャッジ時間 13,389 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, raw_input().split())
sequence = [[]]
memo = []
while sequence != []:
	now = sequence.pop(0)
	if len(now) == N: memo.append(now)
	else:
		for i in range(0, N):
			newseq = []
			for j in range(0, len(now)):
				newseq.append(now[j])
			if i not in newseq:
				newseq.append(i)
				sequence.append(newseq)
pointlist = []
for i in range(0, M):
	pointlist.append(map(int, raw_input().split()))
max = 0
for i in range(0, len(memo)):
	sum = 0
	for j in range(0, M):
		if memo[i][pointlist[j][0]] < memo[i][pointlist[j][1]]:
			sum += pointlist[j][2]
	if max < sum: max = sum
print max
0