# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472341 | elgamalsalman | Toll (BOI17_toll) | C++14 | 3077 ms | 10172 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
ll k, n, m, o, dp[50050];
vvii adj;
void getToll(ll u, ll v) {
//cerr << "// getToll(" << u << ", " << v << ")\n";
if (dp[u] != -1) return;
if (u == v) { dp[u] = 0; return; }
if (u/k >= v/k) { dp[u] = 1e10; return; }
//if (u == 1) cerr << "// check1\n";
ll minToll = 1e10;
for (ii edge : adj[u]) {
//if (u == 1) cerr << "// check2 {" << edge.fi << ", " << edge.se << "}\n";
getToll(edge.fi, v);
if (dp[edge.fi] >= 1e10) continue;
ll currToll = dp[edge.fi] + edge.se;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |