結果

問題 No.90 品物の並び替え
ユーザー GrayCoderGrayCoder
提出日時 2017-09-18 07:33:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-25 15:18:08
合計ジャッジ時間 4,388 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import itertools

def main():
    N, M = map(int, input().split())
    gen = (map(int, input().split()) for _ in range(M))
    x = {str(k1) + str(k2): v for k1, k2, v in gen}

    score = 0
    for i in itertools.permutations(range(N)):
        lineup = ''.join(map(str, i))
        score_ = 0
        for k, v in x.items():
            if k in lineup:
                score_ += v
        score = max(score, score_)

    print(score)

main()
0