結果

問題 No.90 品物の並び替え
ユーザー _matumo__matumo_
提出日時 2019-12-05 19:55:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 390 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 8,340 KB
最終ジャッジ日時 2023-08-23 12:42:16
合計ジャッジ時間 999 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import itertools
def main():
    N,M=map(int,input().split())
    p=[[0]*N for _ in range(N)]
    for _ in range(M):
        a,b,c=map(int,input().split())
        p[a][b]=c
    Max=0
    for r in itertools.permutations(range(N)):
        sum=0
        for d,e in itertools.permutations(r,2):
            if p.index(d)<p.index(e): sum+=p[d][e]
        Max=max(Max,sum)
    print(Max)
main()
0