結果

問題 No.90 品物の並び替え
ユーザー maatanbetamaatanbeta
提出日時 2017-04-27 15:05:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 55,688 KB
最終ジャッジ日時 2023-10-11 16:03:44
合計ジャッジ時間 8,677 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N, M = map(int, input().split())
item1 = [0] * M
item2 = [0] * M
score = [0] * M
max_score = 0
# sheat = []
"""
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]

perm = [i for i in range(N)]

p = list(itertools.permutations(perm))

for ichi in p:
    temp = 0
    for i in range(M):
        if ichi[item1[i]-1] < ichi[item2[i]-1]:
            temp += score[i]
    if temp > max_score:
        max_score = temp
        max_retu = ichi

print(max_score)
print(max_retu)
0