結果

問題 No.90 品物の並び替え
ユーザー masumasumath1masumasumath1
提出日時 2019-11-30 11:50:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 500 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-05-01 01:53:25
合計ジャッジ時間 1,186 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sys
import itertools
N, M = map(int,input().split())
listN = [i for i in range(1,N+1)]
score = []
for i in range(M):
    a,b,sc = map(int,input().split())
    score.append([a,b,sc])
score.sort()
for t in itertools.permutations(listN):
    score = 0
    for i in range(N-1):
        for s in score:
            if t[i] == s[0] and t[i+1] == s[1]:
                    score += s[2]
                    break
            elif s[0] > t[i]:
                break
    ans = max(ans,score)
print(ans)
0