結果
問題 | No.90 品物の並び替え |
ユーザー |
|
提出日時 | 2019-12-31 11:45:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 559 ms / 5,000 ms |
コード長 | 376 bytes |
コンパイル時間 | 514 ms |
コンパイル使用メモリ | 82,544 KB |
実行使用メモリ | 130,488 KB |
最終ジャッジ日時 | 2024-11-18 09:53:37 |
合計ジャッジ時間 | 2,155 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
# 2019/12/31 from itertools import permutations n,m=map(int,input().split()) items=[tuple(map(int,input().split())) for _ in range(m)] ps=list(permutations(range(n),n)) ans=0 for p in ps: cnt=0 pp=[None]*n for i in range(n): pp[p[i]]=i for item in items: u,v,c=item if pp[u]<pp[v]: cnt+=c ans=max(ans,cnt) print(ans)