結果
問題 | No.90 品物の並び替え |
ユーザー | Masahiro Hayashi |
提出日時 | 2014-12-26 02:24:43 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 2,340 ms / 5,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 502 ms |
コンパイル使用メモリ | 7,160 KB |
実行使用メモリ | 6,132 KB |
最終ジャッジ日時 | 2023-09-03 18:29:45 |
合計ジャッジ時間 | 4,305 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 12 ms
5,996 KB |
testcase_01 | AC | 217 ms
6,132 KB |
testcase_02 | AC | 12 ms
5,948 KB |
testcase_03 | AC | 33 ms
6,044 KB |
testcase_04 | AC | 33 ms
6,060 KB |
testcase_05 | AC | 216 ms
6,012 KB |
testcase_06 | AC | 219 ms
6,012 KB |
testcase_07 | AC | 14 ms
6,100 KB |
testcase_08 | AC | 12 ms
6,068 KB |
testcase_09 | AC | 2,340 ms
6,056 KB |
ソースコード
#!/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)