結果

問題 No.90 品物の並び替え
ユーザー O2MTO2MT
提出日時 2020-10-23 00:55:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 12,512 KB
最終ジャッジ日時 2023-09-28 14:59:57
合計ジャッジ時間 8,878 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from itertools import permutations
N,M = map(int,input().split())
l = [[] for _ in range(N)]
ans = 0
for _ in range(M):
    i,y,s = map(int,input().split())
    l[i].append([y,s])
for perm in permutations(range(N)):
    perm = list(perm)
    now = 0
    for i in range(N):
        for item,score in l[i]:
            if item in perm[:i]:
                now += score
    ans = max(ans,now)
print(ans)
0