結果

問題 No.90 品物の並び替え
コンテスト
ユーザー なえしら
提出日時 2023-11-22 23:45:40
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 365 ms / 5,000 ms
+ 130µs
コード長 304 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 70 ms
コンパイル使用メモリ 80,892 KB
実行使用メモリ 82,816 KB
最終ジャッジ日時 2026-10-12 03:35:54
合計ジャッジ時間 2,364 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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