結果

問題 No.1301 Strange Graph Shortest Path
コンテスト
ユーザー KoD
提出日時 2020-11-27 23:45:04
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.90.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 190 ms / 3,000 ms
コード長 949 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,034 ms
コンパイル使用メモリ 105,804 KB
実行使用メモリ 60,384 KB
最終ジャッジ日時 2026-06-15 11:41:26
合計ジャッジ時間 8,142 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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