結果

問題 No.1301 Strange Graph Shortest Path
ユーザー KoD
提出日時 2020-11-27 23:45:04
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 285 ms / 3,000 ms
コード長 949 bytes
コンパイル時間 5,139 ms
コンパイル使用メモリ 137,528 KB
最終ジャッジ日時 2025-01-16 08:41:50
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#line 1 "main.cpp"

/**
 * @title Template
 */

#include <iostream>
#include <algorithm>
#include <utility>
#include <numeric>
#include <vector>
#include <array>
#include <cassert>
#include <queue>
#line 1 "/Users/kodamankod/Desktop/ac-library/atcoder/mincostflow"
#include <atcoder/mincostflow.hpp>
#line 15 "main.cpp"

using i32 = std::int32_t;
using i64 = std::int64_t;
using u32 = std::uint32_t;
using u64 = std::uint64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr i32 inf32 = (i32(1) << 30) - 1;
constexpr i64 inf64 = (i64(1) << 62) - 1;

int main() {
  usize N, M;
  std::cin >> N >> M;
  atcoder::mcf_graph<i32, i64> net(N);
  while (M--) {
    usize u, v;
    i64 c, d;
    std::cin >> u >> v >> c >> d;
    u -= 1; v -= 1;
    net.add_edge(u, v, 1, c);
    net.add_edge(u, v, 1, d);
    net.add_edge(v, u, 1, c);
    net.add_edge(v, u, 1, d);
  }
  std::cout << net.flow(0, N - 1, 2).second << '\n';
  return 0;
}
0