Approach 전형적인 LCA 문제 Code #include #define fastio cin.tie(0)->sync_with_stdio(0) using namespace std; using ll = long long; using pii = pair; int move_x[4] = {-1, 1, 0, 0}; int move_y[4] = {0, 0, -1, 1}; const int MAX = 18; vector adj[100001]; int parent[100001][18]; int depth[100001]; bool visited[100001]; void dfs(int cur, int cur_depth){ visited[cur] = 1; depth[cur] = cur_depth; for(auto &p :..
[백준 11438번] [LCA] LCA 2
Approach 전형적인 LCA 문제 Code #include #define fastio cin.tie(0)->sync_with_stdio(0) using namespace std; using ll = long long; using pii = pair; int move_x[4] = {-1, 1, 0, 0}; int move_y[4] = {0, 0, -1, 1}; const int MAX = 18; vector adj[100001]; int parent[100001][18]; int depth[100001]; bool visited[100001]; void dfs(int cur, int cur_depth){ visited[cur] = 1; depth[cur] = cur_depth; for(auto &p :..
2022.01.29