CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 02:45:49 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=90e06ebcebf003e2766f7ab8540aca5eaebc238b54db4c0ca6faf163ae3bab2ba%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22mPvnnJR4FAnfXD8-MhhU4i8ugGXvxTYQ%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d34363bbc5ccbb-BLR
#include<bits/stdc++.h>#define P(x,y) make_pair(x,y)using namespace std;co - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define P(x,y) make_pair(x,y)
- using namespace std;
- const int MX=100009 , MXL=18;
- // set those to appropriate values
- vector < int > v[MX];
- int n , QN , depth[MX] , par[MXL][MX] ;
- int sum[MX] ;
- void Pdfs(int x , int p){
- int nxt , C , sz=v[x].size();
- for(int j=0;j<sz;j++){
- nxt=v[x][j];
- if(nxt == p) continue;
- depth[nxt]=depth[x]+1;
- par[0][nxt]=x;
- Pdfs(nxt , x);
- }
- }
- void process(){
- for(int j=1;j<MXL;j++)
- for(int i=1;i<=n;i++)
- par[j][i]=par[j-1][par[j-1][i]];
- }
- int Kth(int x , int K){
- int node=x;
- for(int j=0;j<MXL;j++)
- if((K&(1<<j)))
- node=par[j][node];
- return node;
- }
- int LCA(int a , int b){
- if(a==b) return a;
- if(depth[a] > depth[b]) swap(a , b);
- b=Kth(b , depth[b]-depth[a]);
- if(a==b) return b;
- for(int j=MXL-1;j>=0;j--)
- if(par[j][a] != par[j][b])
- a=par[j][a] , b=par[j][b];
- return par[0][a];
- }
- int main(){
- for(int j=1;j<=n;j++) v[j].clear();
- memset(par , 0 , sizeof(par));
- depth[1]=1;
- Pdfs(1 , -1);
- process();
- }
Add Comment
Please, Sign In to add comment
-
✅⭐ Make huge profits on trading ⭐⭐ S
JavaScript | 2 sec ago | 0.25 KB
-
⭐⭐⭐Exploit 500$ in 15 Minutes⭐⭐
Java | 3 sec ago | 0.10 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ E
JavaScript | 7 sec ago | 0.25 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 11 sec ago | 0.25 KB
-
⭐⭐⭐MAKE $900 INSTANTLY⭐⭐
Java | 14 sec ago | 0.10 KB
-
📌 Swapzone +37% glitch ⭐ T
JavaScript | 16 sec ago | 0.25 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ G
JavaScript | 20 sec ago | 0.25 KB
-
⭐⭐⭐Instant Profit Method⭐⭐
Java | 24 sec ago | 0.10 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand