# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
387976 | ritul_kr_singh | Factories (JOI14_factories) | C++17 | 7102 ms | 173004 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 ll long long
#define sp << ' ' <<
#define nl << '\n'
#define v e.first
#define w e.second
#include "factories.h"
const int MAXN = 5e5;
const ll INF = 1e18;
vector<vector<pair<int, ll>>> g(MAXN);
vector<vector<ll>> dist(20, vector<ll> (MAXN));
vector<int> s(MAXN), depth(MAXN), parent(MAXN);
vector<bool> r(MAXN);
vector<ll> ans(MAXN, INF);
int calcSize(int u, int p){
s[u] = 1;
for(auto &e : g[u]) if(v != p and !r[v]) s[u] += calcSize(v, u);
return s[u];
}
void calcDist(int u, int p, ll currDist, int lvl){
dist[lvl][u] = currDist;
for(auto &e : g[u]) if(v != p and !r[v]) calcDist(v, u, currDist + w, lvl);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |