結果

問題 No.90 品物の並び替え
ユーザー maatanbetamaatanbeta
提出日時 2017-04-26 12:37:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 462 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 55,516 KB
最終ジャッジ日時 2023-10-11 15:13:59
合計ジャッジ時間 8,589 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,076 KB
testcase_01 AC 522 ms
12,832 KB
testcase_02 AC 16 ms
8,188 KB
testcase_03 AC 46 ms
8,672 KB
testcase_04 AC 68 ms
8,608 KB
testcase_05 AC 586 ms
12,852 KB
testcase_06 AC 408 ms
12,980 KB
testcase_07 AC 22 ms
8,184 KB
testcase_08 AC 15 ms
8,108 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N, M = map(int, input().split())
item1 = [0] * M
item2 = [0] * M
score = [0] * M
max_score = 0

for i in range(M):
    item1[i], item2[i], score[i] = map(int, input().split())

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

print(max_score)
0