版本比较
题解:P13986 [PO Final 2023] 降重 / Synonyms
正文
增加 8 行删除 8 行
31 行未改动32333435363738394041424344454647484950515253545556575859606162636465666768697071727374758 行未改动31 行未改动int cnt1 = 0;int cnt2 = 0;int main(){std :: cin >> n;for (int i = 1; i <= n; i++){string a, b;std :: cin >> a >> b;if (!x[a]){cnt1 ++;x[a] = cnt1;}word1[x[a]].push_back(b);if (!y[b]){cnt2 ++;y[b] = cnt2;}word2[y[b]].push_back(a);}std :: cin >> m;for (int i = 1; i <= m; i++){string a;std :: cin >> a;string ans = a;bool found = false;for (auto &t : word1[x[a]]){for (auto &s : word2[y[t]]){if (s != a){ans = s;found = true;break;8 行未改动31 行未改动32333435363738394041424344454647484950515253545556575859606162636465666768697071727374758 行未改动31 行未改动int cnt1 = 0;int cnt2 = 0;int main(){std :: cin >> n;for (int i = 1; i <= n; i++){string a, b;std :: cin >> a >> b;if (!x[a]){cnt1 ++;x[a] = cnt1;}word1[x[a]].push_back(b);if (!y[b]){cnt2 ++;y[b] = cnt2;}word2[y[b]].push_back(a);}std :: cin >> m;for (int i = 1; i <= m; i++){string a;std :: cin >> a;string ans = a;bool found = false;for (auto &t : word1[x[a]]){for (auto &s : word2[y[t]]){if (s != a){ans = s;found = true;break;8 行未改动