結果

問題 No.90 品物の並び替え
ユーザー masumasumath1masumasumath1
提出日時 2019-11-30 12:40:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 578 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,632 KB
最終ジャッジ日時 2024-05-01 01:54:56
合計ジャッジ時間 6,776 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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