From 0251cb5c553f44c2d431d0050e0990cf573510e2 Mon Sep 17 00:00:00 2001 From: Ta180m Date: Thu, 30 Apr 2020 22:15:33 -0500 Subject: Rename 2019/December/pump.cpp to 2019/December/Gold/pump.cpp --- 2019/December/Gold/pump.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++++ 2019/December/pump.cpp | 46 --------------------------------------------- 2 files changed, 46 insertions(+), 46 deletions(-) create mode 100644 2019/December/Gold/pump.cpp delete mode 100644 2019/December/pump.cpp diff --git a/2019/December/Gold/pump.cpp b/2019/December/Gold/pump.cpp new file mode 100644 index 0000000..20beb76 --- /dev/null +++ b/2019/December/Gold/pump.cpp @@ -0,0 +1,46 @@ +#include +#define f first +#define s second +using namespace std; +typedef long long ll; +typedef pair ii; +typedef vector vi; +typedef vector vii; +constexpr int INF = 1e9; + +vector> G[1001]; + +int main() { + ifstream cin("pump.in"); + ofstream cout("pump.out"); + + int N, M; + cin >> N >> M; + while (M--) { + int a, b, c, f; + cin >> a >> b >> c >> f; + G[a].emplace_back(b, ii(c, f)); + G[b].emplace_back(a, ii(c, f)); + } + + int ans = 0; + for (int i = 1; i <= 1000; ++i) { + vi dist(N + 1, INF); + dist[1] = 0; + priority_queue> pq; + pq.emplace(0, 1); + while (!pq.empty()) { + int d = pq.top().f, u = pq.top().s; + pq.pop(); + if (d > dist[u]) continue; + for (auto& v : G[u]) { + if (v.s.s >= i && d + v.s.f < dist[v.f]) { + dist[v.f] = d + v.s.f; + pq.emplace(dist[v.f], v.f); + } + } + } + ans = max((int)1e6 * i / dist[N], ans); + } + cout << ans << '\n'; +} diff --git a/2019/December/pump.cpp b/2019/December/pump.cpp deleted file mode 100644 index 20beb76..0000000 --- a/2019/December/pump.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -#define f first -#define s second -using namespace std; -typedef long long ll; -typedef pair ii; -typedef vector vi; -typedef vector vii; -constexpr int INF = 1e9; - -vector> G[1001]; - -int main() { - ifstream cin("pump.in"); - ofstream cout("pump.out"); - - int N, M; - cin >> N >> M; - while (M--) { - int a, b, c, f; - cin >> a >> b >> c >> f; - G[a].emplace_back(b, ii(c, f)); - G[b].emplace_back(a, ii(c, f)); - } - - int ans = 0; - for (int i = 1; i <= 1000; ++i) { - vi dist(N + 1, INF); - dist[1] = 0; - priority_queue> pq; - pq.emplace(0, 1); - while (!pq.empty()) { - int d = pq.top().f, u = pq.top().s; - pq.pop(); - if (d > dist[u]) continue; - for (auto& v : G[u]) { - if (v.s.s >= i && d + v.s.f < dist[v.f]) { - dist[v.f] = d + v.s.f; - pq.emplace(dist[v.f], v.f); - } - } - } - ans = max((int)1e6 * i / dist[N], ans); - } - cout << ans << '\n'; -} -- cgit v1.2.3-70-g09d2