結果

問題 No.90 品物の並び替え
コンテスト
ユーザー T
提出日時 2025-11-23 15:22:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 383 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 17,828 KB
最終ジャッジ日時 2025-11-23 15:23:01
合計ジャッジ時間 9,049 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import itertools

N, M = map(int, input().split())
S = [tuple(map(int, input().split())) for i in range(M)]
score = 0

for order in itertools.permutations(range(N)):
  pos = [0]*N
  for i, item in enumerate(order):
    pos[item] = i
  total = 0
  for a, b, s in S:
    if (pos[a] < pos[b]):
      total += s
    else:
      pass

  if (total > score):
    score = total

print(score)
0