結果

問題 No.90 品物の並び替え
ユーザー sue_charo
提出日時 2017-04-13 12:23:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 461 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-18 12:54:52
合計ジャッジ時間 6,448 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
from itertools import permutations
from itertools import combinations

N, M = map(int, input().split())
scores = [[0] * N for __ in range(N)]

for __ in range(M):
    i1, i2, sc = map(int, input().split())
    scores[i1][i2] = sc

max_score = 0
for per in permutations(range(N)):
    tmp_score = 0
    for i in range(N):
        for j in per[i:]:
            tmp_score += scores[i][j]
    max_score = max(max_score, tmp_score)

print(max_score)
0