aboutsummaryrefslogtreecommitdiff
path: root/20/day2/meet.cpp
diff options
context:
space:
mode:
authorAnthony Wang2020-10-06 17:25:38 -0500
committerAnthony Wang2020-10-06 17:25:38 -0500
commitd1791b90ae00a4f688218a9810e55d1db5311cdc (patch)
tree943c8bba67605bfdfae952e5c978eb4cab2dec4a /20/day2/meet.cpp
parentb356f63f0ba062096adf52ca69cfc366001c68a4 (diff)
Restructured directoriesHEADmaster
Diffstat (limited to '20/day2/meet.cpp')
-rw-r--r--20/day2/meet.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/20/day2/meet.cpp b/20/day2/meet.cpp
new file mode 100644
index 0000000..4f37159
--- /dev/null
+++ b/20/day2/meet.cpp
@@ -0,0 +1,32 @@
+#include <bits/stdc++.h>
+#define f first
+#define s second
+using namespace std;
+typedef long long ll;
+typedef pair<int, int> ii;
+
+int a[303];
+vector<int> G[303];
+
+void dfs(int u, int p) {
+ for (auto& v : G[u]) {
+ dfs(v, u);
+
+ }
+
+
+}
+
+int main() {
+ int N;
+ cin >> N;
+ for (int i = 0; i < N; ++i) cin >> a[i];
+ for (int i = 1; i < N; ++i) {
+ int u, v;
+ cin >> u >> v;
+ G[u].push_back(v), G[v].push_back(u);
+ }
+
+ dfs(1, 0);
+
+} \ No newline at end of file