# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
246034 | 2020-07-08T05:11:22 Z | kshitij_sodani | Amusement Park (JOI17_amusement_park) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; typedef long long llo; #define mp make_pair #define pb push_back #define a first #define b second #include "Joi.h" int par[10001]; int find(int no){ if(par[no]==no){ return no; } no=find(par[no]); return no; } vector<int> adj2[10001]; long long xx; int co=0; void dfs3(int no,int par2=-1){ if((xx)&((llo)((llo)1<<co))){ MessageBoard(no,1); } else{ MessageBoard(no,0); } co=(co+1)%60; for(auto j:adj2[no]){ if(j==par2){ continue; } dfs3(j,no); } } void Joi(int N, int M, int A[], int B[], long long X, int T) { xx=X; for(int i=0;i<N;i++){ par[i]=i; } for(int i=0;i<M;i++){ int x=find(A[i]); int y=find(B[i]); if(x!=y){ par[x]=y; adj2[A[i]].pb(B[i]); adj2[B[i]].pb(A[i]); kol+=1; } } dfs3(0); }