結果

問題 No.90 品物の並び替え
コンテスト
ユーザー masumasumath1
提出日時 2019-11-30 12:40:39
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 578 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2026-09-27 07:18:16
合計ジャッジ時間 27,318 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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