結果

問題 No.90 品物の並び替え
ユーザー MtBotOMtBotO
提出日時 2017-09-17 18:08:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 629 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 60,572 KB
最終ジャッジ日時 2024-04-25 14:58:33
合計ジャッジ時間 8,479 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,880 KB
testcase_01 AC 477 ms
15,744 KB
testcase_02 AC 31 ms
10,880 KB
testcase_03 AC 56 ms
11,264 KB
testcase_04 AC 74 ms
11,264 KB
testcase_05 AC 547 ms
15,488 KB
testcase_06 AC 372 ms
15,488 KB
testcase_07 AC 35 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

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