結果
| 問題 | No.90 品物の並び替え |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-26 09:46:46 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 4,571 ms / 5,000 ms |
| コード長 | 387 bytes |
| 記録 | |
| コンパイル時間 | 165 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 80,512 KB |
| 最終ジャッジ日時 | 2026-05-27 16:48:02 |
| 合計ジャッジ時間 | 6,918 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
from itertools import permutations
N, M = map(int, input().split())
S = []
for _ in range(M):
s = list(map(int, input().split()))
S.append(s)
A = [i for i in range(N)]
MAX = 0
for v in permutations(A):
SUM = 0
for s in S:
index1 = v.index(s[0])
index2 = v.index(s[1])
if index1 < index2:
SUM += s[2]
MAX = max(MAX, SUM)
print(MAX)