結果
問題 |
No.90 品物の並び替え
|
ユーザー |
|
提出日時 | 2021-02-26 17:56:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 227 ms / 5,000 ms |
コード長 | 394 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 82,412 KB |
実行使用メモリ | 75,908 KB |
最終ジャッジ日時 | 2024-10-02 09:23:41 |
合計ジャッジ時間 | 1,481 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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, s = map(int, input().split()) score[a][b] += s from itertools import permutations l = [i for i in range(N)] ans = 0 for p in permutations(l): p = list(p) s = 0 for i in range(N): for j in range(i + 1, N): s += score[p[i]][p[j]] ans = max(ans, s) print(ans)