結果
問題 |
No.90 品物の並び替え
|
ユーザー |
|
提出日時 | 2021-06-28 21:18:00 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 546 bytes |
コンパイル時間 | 119 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-25 15:54:54 |
合計ジャッジ時間 | 1,121 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 9 |
ソースコード
n, m = [int(s) for s in input().split()] table = [[0 for _ in range(n)] for _ in range(n)] for i in range(m): item1, item2, score = map(int, input().split()) table[item1][item2] = score print(table) dp = [0] * (1 << n) for x in range(0, 1 << n): for i in range(n): if x & (1 << i): continue score = dp[x] for j in range(n): if x & (1 << j): score += table[j][i] v = x | (1 << i) if dp[v] < score: dp[v] = score print(dp[(1 << n) - 1])