結果
問題 | No.90 品物の並び替え |
ユーザー |
![]() |
提出日時 | 2017-12-11 09:03:33 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 39 ms / 5,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-30 11:34:32 |
合計ジャッジ時間 | 1,110 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
n, m = map(int, input().split())score = [[0] * n for i in range(n)]for i in range(m):a, b, c = map(int, input().split())score[a][b] = ccomb = (1 << n) - 1dp = [0] * (comb + 1)for c in range(1, comb):for i in range(n):f1 = 1 << iif not c & f1 == 0:continuecf = c | f1s = dp[c]for j in range(n):f2 = 1 << jif c & f2 == 0:continues += score[j][i]dp[cf] = max(s, dp[cf])print(dp[-1])