結果

問題 No.90 品物の並び替え
ユーザー bug maker / ばぐめいかー@Python学習者bug maker / ばぐめいかー@Python学習者
提出日時 2023-07-08 19:28:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 452 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 10,992 KB
実行使用メモリ 55,528 KB
最終ジャッジ日時 2023-09-29 20:58:45
合計ジャッジ時間 8,879 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,172 KB
testcase_01 AC 667 ms
13,124 KB
testcase_02 AC 15 ms
8,176 KB
testcase_03 AC 53 ms
8,644 KB
testcase_04 AC 79 ms
8,684 KB
testcase_05 AC 737 ms
13,104 KB
testcase_06 AC 514 ms
13,152 KB
testcase_07 AC 21 ms
8,236 KB
testcase_08 AC 14 ms
8,212 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

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

i1 = [0] * M
i2 = [0] * M
s = [0] * M

for i in range(M):
    i1[i], i2[i], s[i] = input().split()
    i1[i] = int(i1[i])
    i2[i] = int(i2[i])
    s[i] = int(s[i])

t = list(itertools.permutations(range(N), N))
s_Max = 0

for p in t:
    s_max = 0
    for i in range(M):
        if p.index(i1[i]) < p.index(i2[i]):
            s_max += s[i]
    if s_max > s_Max:
        s_Max = s_max

print(s_Max)
0