結果
問題 |
No.90 品物の並び替え
|
ユーザー |
|
提出日時 | 2014-12-26 02:24:43 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 2,258 ms / 5,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 384 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 23:43:19 |
合計ジャッジ時間 | 4,040 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#!/usr/bin/env python2.7 import sys import itertools def read_n(): return map(int,raw_input().strip().split(" ")) def compute(arr, N): result = 0 for pat in itertools.permutations(range(0, N)): total = 0 for i in range(0, N - 1): for j in range(i + 1, N): total += arr[pat[i]][pat[j]] result = max([total, result]) return result (N, M) = read_n() arr = [[0 for y in range(0, N)] for x in range(0,N)] for i in range(0,M): (i1, i2, val) = read_n() arr[i1][i2] = val print compute(arr, N)