結果

問題 No.90 品物の並び替え
ユーザー O2MTO2MT
提出日時 2020-10-23 01:09:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 732 ms / 5,000 ms
コード長 452 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 76,940 KB
最終ジャッジ日時 2023-09-28 15:00:13
合計ジャッジ時間 2,733 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,476 KB
testcase_01 AC 150 ms
76,940 KB
testcase_02 AC 79 ms
71,260 KB
testcase_03 AC 96 ms
76,052 KB
testcase_04 AC 91 ms
76,428 KB
testcase_05 AC 142 ms
76,500 KB
testcase_06 AC 135 ms
76,556 KB
testcase_07 AC 87 ms
76,376 KB
testcase_08 AC 79 ms
71,152 KB
testcase_09 AC 732 ms
76,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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