結果

問題 No.90 品物の並び替え
ユーザー takakintakakin
提出日時 2020-04-18 16:31:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 344 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-14 21:00:07
合計ジャッジ時間 8,861 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,624 KB
testcase_01 AC 631 ms
10,624 KB
testcase_02 AC 29 ms
10,624 KB
testcase_03 AC 66 ms
10,624 KB
testcase_04 AC 89 ms
10,752 KB
testcase_05 AC 656 ms
10,624 KB
testcase_06 AC 501 ms
10,752 KB
testcase_07 AC 37 ms
10,752 KB
testcase_08 AC 29 ms
10,752 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,m=map(int,input().split())
S=[[int(i) for i in input().split()] for _ in range(m)]
ans=0
import itertools
for P in itertools.permutations(range(n)):
  D=dict()
  for i in range(n):
    D[P[i]]=i
  score=0
  for a,b,c in S:
    if D[a]<D[b]:
      score+=c
  ans=max(ans,score)
print(ans)
0