Tag: Grisha and Underground Solution In C/C++

Codeforces Round #425 (Div. 2), problem: (D) Misha, Grisha and Underground Solution In C/C++

#include<cstdio> #include<iostream> using namespace std; struct Edge{ int to,next; }e; int head,cnt=0; void add(int u,int v) { cnt++; e.to=v; e.next=head; head=cnt; } int anc; int dep; void dfs(int x,int fa) { for(int i=head;i!=0;i=e.next) { int to=e.to; if(to!=fa) { dep=dep+1; anc=x; dfs(to,x); } } } int lca(int...

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!