結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,260 KB
testcase_01 AC 539 ms
8,112 KB
testcase_02 AC 16 ms
8,132 KB
testcase_03 AC 63 ms
8,056 KB
testcase_04 AC 63 ms
8,212 KB
testcase_05 AC 533 ms
8,128 KB
testcase_06 AC 535 ms
8,300 KB
testcase_07 AC 21 ms
8,288 KB
testcase_08 AC 16 ms
8,192 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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