結果

問題 No.90 品物の並び替え
ユーザー roiti46roiti46
提出日時 2014-12-07 19:23:54
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 608 ms
コンパイル使用メモリ 6,672 KB
実行使用メモリ 10,372 KB
最終ジャッジ日時 2023-09-02 09:20:33
合計ジャッジ時間 9,845 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
10,356 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N,M = map(int,raw_input().split())
line = [map(int,raw_input().split()) for _ in range(M)]
line = {i:{j:k} for i,j,k in line}
ans = 0
for ele in itertools.permutations(range(N)):
    tmp = 0
    for i in range(N-1):
        for j in range(i+1,N):
            try:
                tmp += line[ele[i]][ele[j]] 
            except:
                pass
    ans = max(ans,tmp)
print ans
0