結果

問題 No.90 品物の並び替え
ユーザー lllllll88938494lllllll88938494
提出日時 2022-03-14 05:37:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 909 ms / 5,000 ms
コード長 380 bytes
コンパイル時間 1,527 ms
コンパイル使用メモリ 81,512 KB
実行使用メモリ 75,612 KB
最終ジャッジ日時 2023-10-19 18:42:08
合計ジャッジ時間 3,261 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
53,412 KB
testcase_01 AC 134 ms
75,560 KB
testcase_02 AC 41 ms
53,448 KB
testcase_03 AC 64 ms
64,448 KB
testcase_04 AC 61 ms
64,448 KB
testcase_05 AC 133 ms
75,604 KB
testcase_06 AC 111 ms
75,600 KB
testcase_07 AC 59 ms
64,460 KB
testcase_08 AC 45 ms
53,448 KB
testcase_09 AC 909 ms
75,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations as per
n,m=map(int,input().split())
ms=[list(map(int,input().split())) for i in range(m)]
ans=0
for p in per(range(n)):
    dic={}
    for i in range(n):
        dic[p[i]] = i
    point=0
    for j in range(m):
        a,b,c=ms[j]
        if dic[a] < dic[b]:
            point+=c
            
    ans=max(ans,point)
    
print(ans)
            
0