結果
| 問題 | 
                            No.90 品物の並び替え
                             | 
                    
| コンテスト | |
| ユーザー | 
                             sdads
                         | 
                    
| 提出日時 | 2019-02-04 11:27:09 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                MLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 708 bytes | 
| コンパイル時間 | 107 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 821,120 KB | 
| 最終ジャッジ日時 | 2024-12-24 14:00:01 | 
| 合計ジャッジ時間 | 8,997 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 8 MLE * 1 | 
ソースコード
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))
            
            
            
        
            
sdads