結果

問題 No.90 品物の並び替え
ユーザー sdadssdads
提出日時 2019-02-04 11:27:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 708 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 816,332 KB
最終ジャッジ日時 2023-08-26 01:20:35
合計ジャッジ時間 8,010 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,228 KB
testcase_01 AC 715 ms
98,536 KB
testcase_02 AC 17 ms
8,284 KB
testcase_03 AC 72 ms
16,748 KB
testcase_04 AC 74 ms
16,720 KB
testcase_05 AC 711 ms
98,420 KB
testcase_06 AC 704 ms
98,456 KB
testcase_07 AC 22 ms
9,184 KB
testcase_08 AC 15 ms
8,256 KB
testcase_09 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

item1 = []
item2 = []

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

score_book = [[0 for i in range(N)] for j in range(N)]

for n in range(M):
    i, j, k = list(map(int, input().split()))
    item1.append(i)
    item2.append(j)
    score_book[item1[n]][item2[n]] = k

#全てのパターンを網羅する。
permu = list(itertools.permutations([i for i in range(N)], N))
combi = []
for i in permu:
    combi.append(list(itertools.combinations(i, 2)))

combi_len = len(combi)
#全通りのスコアを入れる配列を作る
score_table = [0] * combi_len

for i, co in enumerate(combi):
    for j in co:
        score_table[i] = score_table[i] + score_book[j[0]][j[1]]

print(max(score_table))
0