# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
419475 | amoo_safar | Meetings 2 (JOI21_meetings2) | C++17 | 536 ms | 49220 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.
// vaziat meshki-ghermeze !
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using namespace std;
const int N = 2e5 + 10;
const int Log = 20;
vector<int> G[N];
vector< pair<int, int> > E[N];
int n;
int sp[N][Log];
int sub[N], dep[N];
int DFS(int u, int p, int d){
sp[u][0] = p;
sub[u] = 1;
dep[u] = d;
for(int l = 1; l < Log; l++)
sp[u][l] = sp[ sp[u][l - 1] ][l - 1];
for(auto adj : G[u])
if(adj != p)
sub[u] += DFS(adj, u, d + 1);
E[min(n - sub[u], sub[u])].pb({u, p});
return sub[u];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |