結果

問題 No.2739 Time is money
ユーザー t98slidert98slider
提出日時 2024-04-20 16:38:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 261 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 5,068 ms
コンパイル使用メモリ 270,176 KB
実行使用メモリ 61,928 KB
最終ジャッジ日時 2024-04-20 16:38:11
合計ジャッジ時間 10,327 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 95 ms
37,224 KB
testcase_03 AC 160 ms
53,016 KB
testcase_04 AC 87 ms
36,068 KB
testcase_05 AC 108 ms
40,572 KB
testcase_06 AC 168 ms
54,496 KB
testcase_07 AC 221 ms
61,920 KB
testcase_08 AC 183 ms
61,800 KB
testcase_09 AC 186 ms
61,924 KB
testcase_10 AC 192 ms
61,924 KB
testcase_11 AC 248 ms
61,928 KB
testcase_12 AC 261 ms
61,796 KB
testcase_13 AC 259 ms
61,928 KB
testcase_14 AC 253 ms
61,800 KB
testcase_15 AC 141 ms
60,580 KB
testcase_16 AC 117 ms
61,024 KB
testcase_17 AC 223 ms
61,800 KB
testcase_18 AC 226 ms
61,924 KB
testcase_19 AC 158 ms
60,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, u, v;
    ll x, c, t;
    cin >> n >> m >> x;
    atcoder::mcf_graph<int, ll> g(n);
	while(m--){
        cin >> u >> v >> c >> t;
        g.add_edge(--u, --v, 1, c += t * x);
        g.add_edge(v, u, 1, c);
    }
    auto [fl, ans] = g.flow(0, n - 1, 1);
    cout << (fl ? (ans + x - 1) / x : -1) << '\n';
}
0