結果
| 問題 | No.90 品物の並び替え |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-31 11:42:17 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 4,904 ms / 5,000 ms |
| コード長 | 376 bytes |
| 記録 | |
| コンパイル時間 | 391 ms |
| コンパイル使用メモリ | 20,956 KB |
| 実行使用メモリ | 63,064 KB |
| 最終ジャッジ日時 | 2026-05-12 21:56:21 |
| 合計ジャッジ時間 | 8,361 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)