結果

問題 No.357 品物の並び替え (Middle)
ユーザー ckawatakckawatak
提出日時 2017-10-08 23:29:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 447 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,280 KB
実行使用メモリ 82,752 KB
最終ジャッジ日時 2024-04-28 13:37:28
合計ジャッジ時間 7,472 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
75,904 KB
testcase_01 AC 36 ms
52,352 KB
testcase_02 AC 48 ms
62,848 KB
testcase_03 AC 46 ms
63,104 KB
testcase_04 AC 67 ms
75,840 KB
testcase_05 AC 67 ms
75,776 KB
testcase_06 AC 45 ms
61,440 KB
testcase_07 AC 35 ms
52,736 KB
testcase_08 AC 194 ms
75,712 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N, M = list(map(int, input().split(' ')))

S = []
for i in range(N):
    S.append([0 for _ in range(N)])

for i in range(M):
    f, t, s = list(map(int, input().split(' ')))
    S[f][t] = s

solution = -1
for p in permutations([i for i in range(N)]):
    score = 0
    for i in range(N):
        for j in range(i+1, N):
            score += S[p[i]][p[j]]
    solution = max(solution, score)
print(solution)    
0