結果

問題 No.1301 Strange Graph Shortest Path
ユーザー Shun_PIShun_PI
提出日時 2020-11-28 00:04:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 123 ms / 3,000 ms
コード長 1,207 bytes
コンパイル時間 2,067 ms
コンパイル使用メモリ 188,708 KB
実行使用メモリ 64,472 KB
最終ジャッジ日時 2023-10-09 22:12:33
合計ジャッジ時間 7,250 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 102 ms
60,924 KB
testcase_03 AC 91 ms
54,320 KB
testcase_04 AC 116 ms
63,900 KB
testcase_05 AC 97 ms
61,264 KB
testcase_06 AC 108 ms
58,808 KB
testcase_07 AC 106 ms
59,284 KB
testcase_08 AC 94 ms
55,572 KB
testcase_09 AC 98 ms
56,256 KB
testcase_10 AC 92 ms
55,644 KB
testcase_11 AC 117 ms
61,440 KB
testcase_12 AC 103 ms
60,440 KB
testcase_13 AC 95 ms
61,324 KB
testcase_14 AC 104 ms
56,432 KB
testcase_15 AC 94 ms
56,340 KB
testcase_16 AC 117 ms
64,472 KB
testcase_17 AC 113 ms
63,376 KB
testcase_18 AC 103 ms
57,492 KB
testcase_19 AC 102 ms
59,128 KB
testcase_20 AC 109 ms
58,340 KB
testcase_21 AC 106 ms
61,156 KB
testcase_22 AC 113 ms
59,596 KB
testcase_23 AC 104 ms
62,036 KB
testcase_24 AC 113 ms
60,140 KB
testcase_25 AC 119 ms
64,472 KB
testcase_26 AC 110 ms
59,560 KB
testcase_27 AC 103 ms
60,756 KB
testcase_28 AC 92 ms
60,752 KB
testcase_29 AC 123 ms
63,312 KB
testcase_30 AC 105 ms
63,632 KB
testcase_31 AC 110 ms
63,304 KB
testcase_32 AC 2 ms
4,352 KB
testcase_33 AC 90 ms
63,404 KB
testcase_34 AC 100 ms
63,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
template<class T>void chmax(T &a, const T &b) { if (a<b) a=b; }
template<class T>void chmin(T &a, const T &b) { if (b<a) a=b; }
#include <atcoder/mincostflow>
using namespace atcoder;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N, M;
  cin >> N >> M;
  mcf_graph<lint, lint> g(N);
  REP(i, M) {
    lint u, v, c, d;
    cin >> u >> v >> c >> d;
    u--; v--;
    g.add_edge(u, v, 1, c);
    g.add_edge(u, v, 1, d);
    g.add_edge(v, u, 1, c);
    g.add_edge(v, u, 1, d);
  }
  PL p = g.flow(0, N-1, 2);
  cout << p.second << endl;
}
0