結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2020-09-20 04:14:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 426 ms / 5,000 ms |
| コード長 | 393 bytes |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 82,576 KB |
| 実行使用メモリ | 76,032 KB |
| 最終ジャッジ日時 | 2024-06-24 04:07:29 |
| 合計ジャッジ時間 | 1,813 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
n, m = map(int, input().split())
X = []
for i in range(m):
a, b, s = map(int, input().split())
X.append((a, b, s))
import itertools
ans = 0
for p in itertools.permutations(range(n)):
q = [0]*n
temp = 0
for i, e in enumerate(p):
q[e] = i
for i in range(m):
a, b, s = X[i]
if q[a] < q[b]:
temp += s
ans = max(ans, temp)
print(ans)
brthyyjp