# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1105417 | minhvule | Hotspot (NOI17_hotspot) | C++17 | 1078 ms | 1524 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>
#define int long long
#define pb push_back
#define freo(task) if(fopen(task".inp", "r")){ freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); }
#define FOR(i, a, b) for(int i=(a),_b = (b); i<=_b; i++)
#define FORD(i, a, b) for(int i=(a),_b = (b); i>=_b; i--)
#define pii pair<int, int>
using namespace std;
const int N = 5e3 + 5;
int n, m, k, pa[N], pb[N], da[N], db[N];
vector<int> g[N];
double sum[N];
void dijkstra(int u, int d[], int pa[]) {
priority_queue<pii, vector<pii>, greater<pii>> pq; // Use a min-heap for Dijkstra
d[u] = 0;
pq.push({0, u});
while (!pq.empty()) {
pii top = pq.top();
pq.pop();
int u = top.second;
if (top.first > d[u]) continue;
for (int v : g[u]) {
if (d[v] > d[u] + 1) {
d[v] = d[u] + 1;
pa[v] = pa[u]; // Carry the path count from u
pq.push({d[v], v});
} else if (d[v] == d[u] + 1) {
pa[v] += pa[u]; // Accumulate path counts
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |