백준 3176 도로 네트워크 혼내주기
lca 응용 문제. sparse table로 2의 지수승의 부모 노드를 저장했듯 최솟값과 최댓값 배열을 만들어서 저장하면 된다. 이 문제를 풀면서 lca와 sparse table을 좀 더 이해한 것 같아서 기분이 좋다!@ #include #define fastio ios::sync_with_stdio(0), cin.tie(0) using namespace std; using ll = long long; using pii = pair; #define all(v) v.begin(), v.end() int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; const int N = 17; vector adj[100001];..
혼내주기
2021. 7. 21. 12:17