結果
問題 |
No.2739 Time is money
|
ユーザー |
|
提出日時 | 2024-04-20 16:38:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 238 ms / 2,000 ms |
コード長 | 474 bytes |
コンパイル時間 | 4,564 ms |
コンパイル使用メモリ | 268,804 KB |
最終ジャッジ日時 | 2025-02-21 06:52:07 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#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'; }