結果

問題 No.90 品物の並び替え
ユーザー 👑 colognecologne
提出日時 2022-01-27 15:52:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 876 ms / 5,000 ms
コード長 440 bytes
コンパイル時間 1,391 ms
コンパイル使用メモリ 86,588 KB
実行使用メモリ 77,332 KB
最終ジャッジ日時 2023-08-26 16:20:00
合計ジャッジ時間 3,763 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,364 KB
testcase_01 AC 151 ms
77,032 KB
testcase_02 AC 73 ms
71,184 KB
testcase_03 AC 100 ms
77,216 KB
testcase_04 AC 103 ms
77,332 KB
testcase_05 AC 159 ms
77,164 KB
testcase_06 AC 140 ms
77,176 KB
testcase_07 AC 85 ms
75,912 KB
testcase_08 AC 72 ms
71,464 KB
testcase_09 AC 876 ms
77,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import itertools


def input(): return sys.stdin.readline().rstrip()


def main():
    N, M = map(int, input().split())
    iis = [list(map(int, input().split())) for i in range(M)]
    ans = 0
    for arr in itertools.permutations(range(N), N):
        ans = max(ans, sum(score if arr[item1] < arr[item2] else 0
                           for item1, item2, score in iis))

    print(ans)


if __name__ == '__main__':
    main()
0