結果
問題 |
No.90 品物の並び替え
|
ユーザー |
|
提出日時 | 2025-06-19 16:02:31 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 4,431 ms / 5,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 365 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 10,240 KB |
最終ジャッジ日時 | 2025-06-19 16:02:38 |
合計ジャッジ時間 | 7,137 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline from itertools import permutations n,m=map(int,readline().split()) m=map(int,read().split()) mat=[[0 for _ in range(n)] for _ in range(n)] a,b,c=zip(*zip(m,m,m)) for aa, bb, cc in zip(a,b,c): mat[aa][bb]+=cc ans=0 for perm in permutations(range(n)): tans=0 for i in range(n): for j in range(i): tans+=mat[perm[i]][perm[j]] ans=max(ans,tans) print(ans)