Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <stdio.h>#include <string.h>#include <string>#include <map>using namespace std;int n, m, fa[101];char s[1000], t[1000];int find(int x, int &h){h = 0;while(fa[x] != -1){++h;x =fa[x];}return x;}int main(){scanf("%d", &n);map<string, int> mp;map<int, string> p;int k = 0;memset(fa, -1, sizeof(fa));for(int i=0; i<n; ++i){scanf("%s%s", s, t);if(mp.find(s) == mp.end())