結果

問題 No.90 品物の並び替え
ユーザー vwxyzvwxyz
提出日時 2022-10-18 11:32:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 485 ms / 5,000 ms
コード長 318 bytes
コンパイル時間 1,779 ms
コンパイル使用メモリ 86,648 KB
実行使用メモリ 76,532 KB
最終ジャッジ日時 2023-09-11 06:10:52
合計ジャッジ時間 3,041 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,324 KB
testcase_01 AC 123 ms
75,920 KB
testcase_02 AC 74 ms
71,496 KB
testcase_03 AC 83 ms
76,244 KB
testcase_04 AC 83 ms
76,016 KB
testcase_05 AC 113 ms
76,100 KB
testcase_06 AC 102 ms
76,128 KB
testcase_07 AC 82 ms
75,964 KB
testcase_08 AC 74 ms
71,484 KB
testcase_09 AC 485 ms
76,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import sys
readline=sys.stdin.readline

N,M=map(int,readline().split())
score=[tuple(map(int,readline().split())) for m in range(M)]
ans=0
for tpl in itertools.permutations([i for i in range(N)]):
    S=0
    for i,j,s in score:
        if tpl[i]<tpl[j]:
            S+=s
    ans=max(ans,S)
print(ans)
0