結果
| 問題 | 
                            No.90 品物の並び替え
                             | 
                    
| コンテスト | |
| ユーザー | 
                             maatanbeta
                         | 
                    
| 提出日時 | 2017-04-27 12:09:23 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 873 bytes | 
| コンパイル時間 | 120 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 30,144 KB | 
| 最終ジャッジ日時 | 2024-09-13 14:47:03 | 
| 合計ジャッジ時間 | 6,557 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | TLE * 1 -- * 8 | 
ソースコード
N, M = map(int, input().split())
item1 = [0] * M
item2 = [0] * M
score = [0] * M
sheat = []
max_score = 0
for p in range(N):
    l = []
    for q in range(N):
        l.append(0)
    sheat.append(l)
for i in range(M):
    item1[i], item2[i], score[i] = map(int, input().split())
    sheat[item1[i]][item2[i]] = score[i]
dic = {}
tup = tuple()
for i in range(N):
    tup += ((i,),)
    dic[(i,)] = 0
new_tup = tup
for i in range(1, N):
    tup = new_tup
    new_tup = tuple()
    for tu in tup:
        for k in range(N):
            if not (k in tu):
                temp = tu + (k,)
                dic[temp] = dic[tu]
                for c in tu:
                    dic[temp] += sheat[c][k]
                new_tup += (temp,)
                if i == N-1:
                    if max_score < dic[temp]:
                        max_score = dic[temp]
print(max_score)
            
            
            
        
            
maatanbeta