結果

問題 No.90 品物の並び替え
ユーザー naesiranaesira
提出日時 2023-11-22 23:45:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 468 ms / 5,000 ms
コード長 304 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 75,168 KB
最終ジャッジ日時 2023-11-22 23:45:43
合計ジャッジ時間 2,348 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 86 ms
66,220 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 47 ms
59,908 KB
testcase_04 AC 44 ms
59,900 KB
testcase_05 AC 77 ms
66,080 KB
testcase_06 AC 65 ms
64,032 KB
testcase_07 AC 43 ms
59,908 KB
testcase_08 AC 35 ms
53,460 KB
testcase_09 AC 468 ms
75,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N, M = map(int, input().split())
table = [tuple(map(int, input().split())) for j in range(M)]

ans = 0
for pos in permutations(range(N)):
  tot = 0
  for item1, item2, score in table:
    if pos[item1] < pos[item2]:
      tot += score
  ans = max(ans, tot)

print(ans)
0