diff options
author | Anthony Wang | 2020-10-06 17:25:38 -0500 |
---|---|---|
committer | Anthony Wang | 2020-10-06 17:25:38 -0500 |
commit | d1791b90ae00a4f688218a9810e55d1db5311cdc (patch) | |
tree | 943c8bba67605bfdfae952e5c978eb4cab2dec4a /20/day2/meet.cpp | |
parent | b356f63f0ba062096adf52ca69cfc366001c68a4 (diff) |
Diffstat (limited to '20/day2/meet.cpp')
-rw-r--r-- | 20/day2/meet.cpp | 32 |
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 |