結果

問題 No.90 品物の並び替え
ユーザー MtBotO
提出日時 2017-09-17 18:08:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 629 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-11-08 01:56:44
合計ジャッジ時間 8,442 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

def main():
    N, M = map(int,input().split())

    max_score = 0
    score = []

    for i in range(M):
        score.append(list(map(int,input().split())))

    data = list(itertools.permutations(range(N)))

    for tg in data:
        rt_score = check(tg, score)
        if max_score < rt_score:
            max_score = rt_score

    print(max_score)

def check(tg ,score ):
    rt_score = 0
    for sc in score:
        ind1 = tg.index(sc[0])
        ind2 = tg.index(sc[1])
        if not(ind1==-1) and ind1 < ind2:
            rt_score += sc[2]

    return rt_score

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