結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-22 23:45:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 435 ms / 5,000 ms |
| コード長 | 304 bytes |
| コンパイル時間 | 207 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 75,136 KB |
| 最終ジャッジ日時 | 2024-09-26 07:43:31 |
| 合計ジャッジ時間 | 1,860 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
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)