結果

問題 No.2739 Time is money
ユーザー t98slidert98slider
提出日時 2024-04-20 16:39:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 419 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 4,565 ms
コンパイル使用メモリ 270,072 KB
実行使用メモリ 62,024 KB
最終ジャッジ日時 2024-04-20 16:40:00
合計ジャッジ時間 11,738 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 162 ms
37,320 KB
testcase_03 AC 269 ms
53,068 KB
testcase_04 AC 180 ms
36,168 KB
testcase_05 AC 200 ms
40,652 KB
testcase_06 AC 305 ms
54,604 KB
testcase_07 AC 371 ms
61,896 KB
testcase_08 AC 379 ms
61,900 KB
testcase_09 AC 355 ms
61,900 KB
testcase_10 AC 322 ms
61,776 KB
testcase_11 AC 377 ms
61,772 KB
testcase_12 AC 419 ms
61,776 KB
testcase_13 AC 378 ms
61,900 KB
testcase_14 AC 353 ms
61,772 KB
testcase_15 AC 276 ms
60,748 KB
testcase_16 AC 248 ms
61,132 KB
testcase_17 AC 337 ms
61,900 KB
testcase_18 AC 364 ms
62,024 KB
testcase_19 AC 313 ms
60,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ll n, m, u, v, 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