結果
問題 | No.90 品物の並び替え |
ユーザー |
|
提出日時 | 2023-08-22 15:40:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 390 ms / 5,000 ms |
コード長 | 374 bytes |
コンパイル時間 | 398 ms |
コンパイル使用メモリ | 82,372 KB |
実行使用メモリ | 76,008 KB |
最終ジャッジ日時 | 2024-12-17 15:19:33 |
合計ジャッジ時間 | 1,778 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
from itertools import permutationsN, M = map(int, input().split())A = [list(map(int, input().split())) for _ in range(M)]ans = 0for p in permutations(range(N)):score = 0d = [0] * Nfor i, v in enumerate(p):d[v] = ifor i in range(M):x, y, z = A[i]if d[x] < d[y]:score += zans = max(ans, score)print(ans)