{"id":27744,"date":"2024-10-27T14:43:32","date_gmt":"2024-10-27T14:43:32","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=27744"},"modified":"2024-11-26T07:15:37","modified_gmt":"2024-11-26T07:15:37","slug":"c-%ec%bd%94%eb%94%a9%ed%85%8c%ec%8a%a4%ed%8a%b8-%ea%b0%95%ec%a2%8c-%ec%b5%9c%ec%86%8c-%ea%b3%b5%ed%86%b5-%ec%a1%b0%ec%83%81-%ea%b5%ac%ed%95%98%ea%b8%b0-1-2","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/27744\/","title":{"rendered":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1"},"content":{"rendered":"<p><body><\/p>\n<p>\n    \ubcf8 \uac15\uc88c\uc5d0\uc11c\ub294 C++ \ud504\ub85c\uadf8\ub798\ubc0d\uc744 \uc774\uc6a9\ud574 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1(Lowest Common Ancestor, LCA)\uc744 \uad6c\ud558\ub294 \ubb38\uc81c\ub97c \ub2e4\ub8f9\ub2c8\ub2e4.<br \/>\n    \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc740 \ub450 \ub178\ub4dc\uc758 \uc870\uc0c1\uc774\uba74\uc11c \ub450 \uc870\uc0c1 \uc911 \uac00\uc7a5 \uae4a\uc740 \ub178\ub4dc\ub97c \uc758\ubbf8\ud569\ub2c8\ub2e4. \uc774 \ubb38\uc81c\ub294 \ud2b8\ub9ac \uc790\ub8cc\uad6c\uc870\uc640 \uae4a\uc774 \uc6b0\uc120 \ud0d0\uc0c9(DFS)\uc744 \uc774\ud574\ud558\ub294 \ub370 \uc720\uc6a9\ud569\ub2c8\ub2e4.\n<\/p>\n<h2>\ubb38\uc81c \uc124\uba85<\/h2>\n<p>\n    \ud2b8\ub9ac\uac00 \uc8fc\uc5b4\uc9c8 \ub54c, \ub450 \ub178\ub4dc A\uc640 B\uc758 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc744 \uad6c\ud558\ub294 \ubb38\uc81c\ub97c \ud574\uacb0\ud574\uc57c \ud569\ub2c8\ub2e4.<br \/>\n    \ud2b8\ub9ac\ub294 \ube44\uc5b4 \uc788\uc9c0 \uc54a\uc73c\uba70, \uc911\ubcf5\ub41c \ub178\ub4dc\ub294 \uc5c6\ub2e4\uace0 \uac00\uc815\ud569\ub2c8\ub2e4. \ub178\ub4dc\uc758 \ubc88\ud638\ub294 1\ubd80\ud130 \uc2dc\uc791\ud569\ub2c8\ub2e4.\n<\/p>\n<h3>\uc785\ub825 \ud615\uc2dd<\/h3>\n<pre>\nN\nA B\n\uc5d0\uc11c N\uc740 \ub178\ub4dc\uc758 \uc218, A\uc640 B\ub294 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc744 \ucc3e\uc744 \ub450 \ub178\ub4dc\uc785\ub2c8\ub2e4. \n\n\ud2b8\ub9ac\ub294 \ub2e4\uc74c\uacfc \uac19\uc774 \uc8fc\uc5b4\uc9d1\ub2c8\ub2e4.\n\ubd80\ubaa8 \ub178\ub4dc\uc640 \uc790\uc2dd \ub178\ub4dc\ub85c \uc774\ub8e8\uc5b4\uc9c4 M\uac1c\uc758 \uc904\uc774 \uc8fc\uc5b4\uc9c0\uba70, \n\uac01 \uc904\uc740 'P C' \ud615\uc2dd\uc73c\ub85c \ubd80\ubaa8 P\uc640 \uc790\uc2dd C\ub97c \ub098\ud0c0\ub0c5\ub2c8\ub2e4.\n<\/pre>\n<h3>\ucd9c\ub825 \ud615\uc2dd<\/h3>\n<pre>\n\ub450 \ub178\ub4dc A\uc640 B\uc758 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc758 \ub178\ub4dc \ubc88\ud638\ub97c \ucd9c\ub825\ud569\ub2c8\ub2e4.\n<\/pre>\n<h2>\uc608\uc81c<\/h2>\n<h3>\uc785\ub825<\/h3>\n<pre>\n7\n4 5\n4 6\n5 3\n6 2\n1 4\n1 7\n<\/pre>\n<h3>\ucd9c\ub825<\/h3>\n<pre>\n4\n<\/pre>\n<h2>\ubb38\uc81c \ubd84\uc11d<\/h2>\n<p>\n    \uc8fc\uc5b4\uc9c4 \uc608\uc81c\uc5d0\uc11c \ud2b8\ub9ac\ub294 \ub2e4\uc74c\uacfc \uac19\uc774 \ub098\ud0c0\ub0bc \uc218 \uc788\uc2b5\ub2c8\ub2e4:\n<\/p>\n<pre>\n        1\n       \/ \\\n      4   7\n     \/ \\\n    5   6\n   \/     \\\n  3       2\n<\/pre>\n<p>\n    \ub178\ub4dc A(5)\uc640 B(3)\uc758 \ucd5c\uc0c1\uc704 \ubd80\ubaa8\uc778 4\uac00 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc785\ub2c8\ub2e4.<br \/>\n    \ub9cc\uc57d \ub178\ub4dc A\uc640 B\uac00 \ub3d9\uc77c\ud55c \uacbd\uc6b0, \uadf8 \ub178\ub4dc \uc790\uccb4\uac00 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc774 \ub429\ub2c8\ub2e4.\n<\/p>\n<h2>\uc54c\uace0\ub9ac\uc998 \uc811\uadfc\ubc95<\/h2>\n<p>\n    \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc744 \ucc3e\uae30 \uc704\ud574 \ub2e4\uc591\ud55c \uc54c\uace0\ub9ac\uc998\uc774 \uc874\uc7ac\ud558\uc9c0\ub9cc, \uc5ec\uae30\uc5d0\uc11c\ub294 \uae4a\uc774 \uc6b0\uc120 \ud0d0\uc0c9(DFS)\uc640 \ubd80\ubaa8 \ub178\ub4dc \ucd94\uc801 \ubc29\uc2dd\uc744 \uc774\uc6a9\ud55c \ubc29\ubc95\uc744 \uc124\uba85\ud558\uaca0\uc2b5\ub2c8\ub2e4.\n<\/p>\n<h3>1. \ud2b8\ub9ac \uad6c\uc870 \uc800\uc7a5<\/h3>\n<p>\n    \uba3c\uc800 \uc778\uc811 \ub9ac\uc2a4\ud2b8\ub97c \uc0ac\uc6a9\ud558\uc5ec \ud2b8\ub9ac\ub97c \uc800\uc7a5\ud558\uaca0\uc2b5\ub2c8\ub2e4. \ubd80\ubaa8 \ub178\ub4dc\ub97c \uc54c\uace0 \uc788\ub2e4\uba74 \uc790\uc2dd \ub178\ub4dc\ub97c \ub9ac\uc2a4\ud2b8\uc5d0 \ucd94\uac00\ud558\ub294 \ubc29\uc2dd\uc73c\ub85c \ud2b8\ub9ac\ub97c \uad6c\uc131\ud569\ub2c8\ub2e4.\n<\/p>\n<h3>2. DFS\ub97c \ud1b5\ud55c \uae4a\uc774 \uc800\uc7a5<\/h3>\n<p>\n    \uac01 \ub178\ub4dc\uc758 \uae4a\uc774\ub97c \uc800\uc7a5\ud558\uace0, \ub178\ub4dc\uc758 \ubd80\ubaa8\ub97c \ucd94\uc801\ud558\uc5ec LCA\ub97c \ucc3e\ub294 \ubc29\ubc95\uc785\ub2c8\ub2e4.<br \/>\n    \uac01 \ub178\ub4dc\uc5d0 \ub300\ud574 \ud0d0\uc0c9\ud558\uba74\uc11c \uae4a\uc774\ub97c \uae30\ub85d\ud558\uace0, \ubd80\ubaa8 \ub178\ub4dc\ub3c4 \ud568\uaed8 \uc800\uc7a5\ud569\ub2c8\ub2e4.\n<\/p>\n<h3>3. LCA \uad6c\ud558\uae30<\/h3>\n<p>\n    \ub450 \ub178\ub4dc A\uc640 B\uc758 \uae4a\uc774\ub97c \ube44\uad50\ud558\uc5ec \uae4a\uc774\uac00 \uc595\uc740 \ub178\ub4dc\ub97c \uc62c\ub9ac\uba74\uc11c \ubd80\ubaa8 \ub178\ub4dc\ub97c \ucd94\uc801\ud569\ub2c8\ub2e4.<br \/>\n    \ub450 \ub178\ub4dc\uac00 \uac19\uc544\uc9c0\uba74 \uadf8 \ub178\ub4dc\uac00 LCA\uc785\ub2c8\ub2e4.\n<\/p>\n<h2>C++ \ucf54\ub4dc \uad6c\ud604<\/h2>\n<p>\n    \ub2e4\uc74c\uc740 C++\ub97c \uc0ac\uc6a9\ud55c \uc54c\uace0\ub9ac\uc998 \ucf54\ub4dc\uc785\ub2c8\ub2e4:\n<\/p>\n<pre><code>\n#include <iostream>\n#include <vector>\n#include <algorithm>\n\nusing namespace std;\n\nvector<int> tree[100001];\nint parent[100001];\nint depth[100001];\n\n\/\/ DFS\ub97c \ud1b5\ud55c \uae4a\uc774\uc640 \ubd80\ubaa8 \uc800\uc7a5\nvoid dfs(int node, int par, int dep) {\n    parent[node] = par;\n    depth[node] = dep;\n    for (int child : tree[node]) {\n        if (child != par) {\n            dfs(child, node, dep + 1);\n        }\n    }\n}\n\n\/\/ \ub450 \ub178\ub4dc\uc758 LCA \uad6c\ud558\uae30\nint findLCA(int a, int b) {\n    \/\/ \uae4a\uc774 \ub9de\ucd94\uae30\n    while (depth[a] &gt; depth[b]) {\n        a = parent[a];\n    }\n    while (depth[b] &gt; depth[a]) {\n        b = parent[b];\n    }\n\n    \/\/ LCA \ucc3e\uae30\n    while (a != b) {\n        a = parent[a];\n        b = parent[b];\n    }\n    return a;\n}\n\nint main() {\n    int N;\n    cin &gt;&gt; N;\n\n    for (int i = 0; i &lt; N - 1; i++) {\n        int u, v;\n        cin &gt;&gt; u &gt;&gt; v;\n        tree[u].push_back(v);\n        tree[v].push_back(u);\n    }\n\n    \/\/ DFS\ub85c \uae4a\uc774\uc640 \ubd80\ubaa8 \uc815\ubcf4 \uc800\uc7a5\n    dfs(1, 0, 0);\n\n    int A, B;\n    cin &gt;&gt; A &gt;&gt; B;\n\n    cout &lt;&lt; findLCA(A, B) &lt;&lt; endl;\n    return 0;\n}\n<\/int><\/algorithm><\/vector><\/iostream><\/code><\/pre>\n<h2>\ucf54\ub4dc \uc124\uba85<\/h2>\n<h3>1. \ud2b8\ub9ac \ud45c\ud604<\/h3>\n<p>\n    \uc8fc\uc5b4\uc9c4 \uc785\ub825\uc5d0 \ub530\ub77c \ud2b8\ub9ac\ub97c \uc778\uc811 \ub9ac\uc2a4\ud2b8 \ud615\ud0dc\ub85c \ud45c\ud604\ud569\ub2c8\ub2e4.<br \/>\n    \uac01\uac01\uc758 \ubd80\ubaa8-\uc790\uc2dd \uad00\uacc4\ub97c \uc800\uc7a5\ud558\uc5ec \ub098\uc911\uc5d0 DFS \ub3d9\uc548 \ucc38\uc870\ud560 \uc218 \uc788\ub3c4\ub85d \ud569\ub2c8\ub2e4.\n<\/p>\n<h3>2. DFS \ud568\uc218<\/h3>\n<p>\n<code>dfs<\/code> \ud568\uc218\ub294 \ud604\uc7ac \ub178\ub4dc, \ubd80\ubaa8 \ub178\ub4dc, \uae4a\uc774\ub97c \uc785\ub825\ubc1b\uc544, \ud574\ub2f9 \ub178\ub4dc\uc758 \ubd80\ubaa8\uc640 \uae4a\uc774\ub97c \uc800\uc7a5\ud558\uace0 \uc21c\ud68c\ud569\ub2c8\ub2e4.<br \/>\n    \uc790\uc2dd \ub178\ub4dc\ub294 \ubd80\ubaa8\uc640 \ub3d9\uc77c\ud558\uc9c0 \uc54a\uc744 \ub54c\ub9cc \ud0d0\uc0c9\ud569\ub2c8\ub2e4.\n<\/p>\n<h3>3. LCA \ud568\uc218<\/h3>\n<p>\n    \ub450 \ub178\ub4dc\uc758 \uae4a\uc774\ub97c \uc870\uc815\ud55c \ub4a4, \ubd80\ubaa8\ub97c \ud0c0\uace0 \uc62c\ub77c\uac00\uba70 \ub450 \ub178\ub4dc\uac00 \uac19\uc544\uc9c0\ub294 \uc9c0\uc810\uc744 \ucc3e\uc2b5\ub2c8\ub2e4.<br \/>\n    \uc774 \uc9c0\uc810\uc774 \ubc14\ub85c \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc785\ub2c8\ub2e4.\n<\/p>\n<h2>\uacb0\ub860<\/h2>\n<p>\n    \uc774\ubc88 \uac15\uc88c\uc5d0\uc11c\ub294 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \ubb38\uc81c\uc758 \uac1c\ub150, \uc811\uadfc\ubc95 \ubc0f C++ \uad6c\ud604\uc744 \uc0b4\ud3b4\ubcf4\uc558\uc2b5\ub2c8\ub2e4.<br \/>\n    \uc774 \ubb38\uc81c\ub294 \ud2b8\ub9ac \uc790\ub8cc\uad6c\uc870\uc758 \uae30\ubcf8 \uac1c\ub150\uc744 \uc774\ud574\ud558\ub294 \ub370 \ub9e4\uc6b0 \uc720\uc6a9\ud558\uba70, \ub2e4\uc591\ud55c \uc751\uc6a9 \ubb38\uc81c\uc5d0\uc11c\ub3c4 \uc790\uc8fc \ub4f1\uc7a5\ud569\ub2c8\ub2e4.<br \/>\n    \uc54c\uace0\ub9ac\uc998 \ubb38\uc81c \ud574\uacb0 \ub2a5\ub825\uc744 \uae30\ub974\uae30 \uc704\ud574 \ub2e4\uac01\ub3c4\ub85c \uc774 \ubb38\uc81c\ub97c \ud480\uc5b4\ubcf4\uc2dc\uae30 \ubc14\ub78d\ub2c8\ub2e4.\n<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ubcf8 \uac15\uc88c\uc5d0\uc11c\ub294 C++ \ud504\ub85c\uadf8\ub798\ubc0d\uc744 \uc774\uc6a9\ud574 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1(Lowest Common Ancestor, LCA)\uc744 \uad6c\ud558\ub294 \ubb38\uc81c\ub97c \ub2e4\ub8f9\ub2c8\ub2e4. \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc740 \ub450 \ub178\ub4dc\uc758 \uc870\uc0c1\uc774\uba74\uc11c \ub450 \uc870\uc0c1 \uc911 \uac00\uc7a5 \uae4a\uc740 \ub178\ub4dc\ub97c \uc758\ubbf8\ud569\ub2c8\ub2e4. \uc774 \ubb38\uc81c\ub294 \ud2b8\ub9ac \uc790\ub8cc\uad6c\uc870\uc640 \uae4a\uc774 \uc6b0\uc120 \ud0d0\uc0c9(DFS)\uc744 \uc774\ud574\ud558\ub294 \ub370 \uc720\uc6a9\ud569\ub2c8\ub2e4. \ubb38\uc81c \uc124\uba85 \ud2b8\ub9ac\uac00 \uc8fc\uc5b4\uc9c8 \ub54c, \ub450 \ub178\ub4dc A\uc640 B\uc758 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc744 \uad6c\ud558\ub294 \ubb38\uc81c\ub97c \ud574\uacb0\ud574\uc57c \ud569\ub2c8\ub2e4. \ud2b8\ub9ac\ub294 \ube44\uc5b4 &hellip; <a href=\"https:\/\/atmokpo.com\/w\/27744\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[25],"tags":[],"class_list":["post-27744","post","type-post","status-publish","format-standard","hentry","category-c---2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/27744\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"\ubcf8 \uac15\uc88c\uc5d0\uc11c\ub294 C++ \ud504\ub85c\uadf8\ub798\ubc0d\uc744 \uc774\uc6a9\ud574 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1(Lowest Common Ancestor, LCA)\uc744 \uad6c\ud558\ub294 \ubb38\uc81c\ub97c \ub2e4\ub8f9\ub2c8\ub2e4. \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc740 \ub450 \ub178\ub4dc\uc758 \uc870\uc0c1\uc774\uba74\uc11c \ub450 \uc870\uc0c1 \uc911 \uac00\uc7a5 \uae4a\uc740 \ub178\ub4dc\ub97c \uc758\ubbf8\ud569\ub2c8\ub2e4. \uc774 \ubb38\uc81c\ub294 \ud2b8\ub9ac \uc790\ub8cc\uad6c\uc870\uc640 \uae4a\uc774 \uc6b0\uc120 \ud0d0\uc0c9(DFS)\uc744 \uc774\ud574\ud558\ub294 \ub370 \uc720\uc6a9\ud569\ub2c8\ub2e4. \ubb38\uc81c \uc124\uba85 \ud2b8\ub9ac\uac00 \uc8fc\uc5b4\uc9c8 \ub54c, \ub450 \ub178\ub4dc A\uc640 B\uc758 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc744 \uad6c\ud558\ub294 \ubb38\uc81c\ub97c \ud574\uacb0\ud574\uc57c \ud569\ub2c8\ub2e4. \ud2b8\ub9ac\ub294 \ube44\uc5b4 &hellip; \ub354 \ubcf4\uae30 &quot;C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/27744\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-27T14:43:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-26T07:15:37+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/27744\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/27744\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1\",\"datePublished\":\"2024-10-27T14:43:32+00:00\",\"dateModified\":\"2024-11-26T07:15:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/27744\/\"},\"wordCount\":27,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/27744\/\",\"url\":\"https:\/\/atmokpo.com\/w\/27744\/\",\"name\":\"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-10-27T14:43:32+00:00\",\"dateModified\":\"2024-11-26T07:15:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/27744\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/27744\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/27744\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/27744\/","og_locale":"ko_KR","og_type":"article","og_title":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"\ubcf8 \uac15\uc88c\uc5d0\uc11c\ub294 C++ \ud504\ub85c\uadf8\ub798\ubc0d\uc744 \uc774\uc6a9\ud574 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1(Lowest Common Ancestor, LCA)\uc744 \uad6c\ud558\ub294 \ubb38\uc81c\ub97c \ub2e4\ub8f9\ub2c8\ub2e4. \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc740 \ub450 \ub178\ub4dc\uc758 \uc870\uc0c1\uc774\uba74\uc11c \ub450 \uc870\uc0c1 \uc911 \uac00\uc7a5 \uae4a\uc740 \ub178\ub4dc\ub97c \uc758\ubbf8\ud569\ub2c8\ub2e4. \uc774 \ubb38\uc81c\ub294 \ud2b8\ub9ac \uc790\ub8cc\uad6c\uc870\uc640 \uae4a\uc774 \uc6b0\uc120 \ud0d0\uc0c9(DFS)\uc744 \uc774\ud574\ud558\ub294 \ub370 \uc720\uc6a9\ud569\ub2c8\ub2e4. \ubb38\uc81c \uc124\uba85 \ud2b8\ub9ac\uac00 \uc8fc\uc5b4\uc9c8 \ub54c, \ub450 \ub178\ub4dc A\uc640 B\uc758 \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1\uc744 \uad6c\ud558\ub294 \ubb38\uc81c\ub97c \ud574\uacb0\ud574\uc57c \ud569\ub2c8\ub2e4. \ud2b8\ub9ac\ub294 \ube44\uc5b4 &hellip; \ub354 \ubcf4\uae30 \"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1\"","og_url":"https:\/\/atmokpo.com\/w\/27744\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-10-27T14:43:32+00:00","article_modified_time":"2024-11-26T07:15:37+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"1\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/27744\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/27744\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1","datePublished":"2024-10-27T14:43:32+00:00","dateModified":"2024-11-26T07:15:37+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/27744\/"},"wordCount":27,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/27744\/","url":"https:\/\/atmokpo.com\/w\/27744\/","name":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-10-27T14:43:32+00:00","dateModified":"2024-11-26T07:15:37+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/27744\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/27744\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/27744\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"C++ \ucf54\ub529\ud14c\uc2a4\ud2b8 \uac15\uc88c, \ucd5c\uc18c \uacf5\ud1b5 \uc870\uc0c1 \uad6c\ud558\uae30 1"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/27744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=27744"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/27744\/revisions"}],"predecessor-version":[{"id":27745,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/27744\/revisions\/27745"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=27744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=27744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=27744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}