結果

問題 No.1301 Strange Graph Shortest Path
ユーザー Kiri8128
提出日時 2020-11-27 22:22:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 357 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-26 19:44:54
合計ジャッジ時間 3,119 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

from networkx import*
N, M = map(int, input().split())
G = MultiDiGraph()
G.add_nodes_from([i for i in range(1, N - 1)])
G.add_node(0, demand = -2)
G.add_node(N - 1, demand = 2)
for i in range(M):
    x, y, c, d = map(int, input().split())
    x, y = x-1, y-1
    G.add_weighted_edges_from([(x, y, c), (x, y, d)], capacity = 1)

print(min_cost_flow_cost(G))
0