# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96971 | tieunhi | Zagrade (COI17_zagrade) | C++14 | 1942 ms | 41080 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 FOR(i, u, v) for (int i = u; i <= v; i++)
#define FORD(i, v, u) for (int i = v; i >= u; i--)
#define ll long long
#define pii pair<int, int>
#define PB push_back
#define mp make_pair
#define F first
#define S second
#define N 300005
#define BASE 37
#define mod 1000000007
#define mid (r + l)/2
using namespace std;
int n, spe[N], sz[N], dd[N], cnt[N], val[N];
long long res = 0;
vector<int> a[N];
void dfsCentroid(int u)
{
spe[u] = 0; sz[u] = 1;
dd[u] = 1;
for (auto v : a[u])
{
if (dd[v]) continue;
dfsCentroid(v);
if (sz[v] > sz[spe[u]]) spe[u] = v;
sz[u] += sz[v];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |