Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <cstdio>#include <cstring>#include <map>using namespace std;const int N = 100005;const int M = 200005;int n, m;int tot, head[N], to[N], next[N];int tot1, head1[N], to1[M], id[M], next1[M];int fa[N], ans[N];char name[100005][100], name1[100], name2[100];bool visit[N];map <string, int> ns;void addEdge(const int& u, const int& v) {to[tot] = v;next[tot] = head[u];head[u] = tot++;}void addEdge1(const int& u, const int& v, const int& i) {to1[tot1] = v;id[tot1] = i;next1[tot1] = head1[u];head1[u] = tot1++;}