結果

問題 No.90 品物の並び替え
ユーザー O2MTO2MT
提出日時 2020-10-23 00:55:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 76,932 KB
最終ジャッジ日時 2023-09-28 15:00:02
合計ジャッジ時間 3,079 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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