結果

問題 No.90 品物の並び替え
コンテスト
ユーザー ckawatak
提出日時 2017-07-20 00:20:26
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 4,127 ms / 5,000 ms
+ 553µs
コード長 472 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 58 ms
コンパイル使用メモリ 14,976 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2026-10-12 01:38:44
合計ジャッジ時間 14,596 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import permutations

n,m = list(map(int, input().split(' ')))        

scores = []
for i in range(n):
    r = [0] * n
    scores.append(r)

for i in range(m):
    left, right, score = list(map(int, input().split(' ')))
    scores[left][right] = score

ms = -1    
for p in permutations(range(n)):
    score = 0
    for i in range(n-1):
        for j in range(i+1,n):
            score += scores[p[i]][p[j]]
            ms = max(ms, score)
print(ms)        
0