結果

問題 No.90 品物の並び替え
ユーザー nebukuro09nebukuro09
提出日時 2016-10-14 16:45:05
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 492 ms / 5,000 ms
コード長 312 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 76,928 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2024-05-01 23:00:43
合計ジャッジ時間 2,620 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
75,520 KB
testcase_01 AC 144 ms
77,440 KB
testcase_02 AC 94 ms
75,264 KB
testcase_03 AC 103 ms
77,312 KB
testcase_04 AC 105 ms
77,568 KB
testcase_05 AC 131 ms
77,440 KB
testcase_06 AC 122 ms
77,696 KB
testcase_07 AC 99 ms
76,672 KB
testcase_08 AC 94 ms
75,264 KB
testcase_09 AC 492 ms
77,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N, M = map(int, raw_input().split())
iis = [map(int, raw_input().split()) for _ in xrange(M)]

m1 = 0
for p in permutations(range(N)):
    m2 = 0
    for item1, item2, score in iis:
        if p[item1] < p[item2]:
            m2 += score
    m1 = max(m1, m2)
print m1        
0