#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n;
cin >> n;
if (n & 1) return cout << -1, 0;
vector<int> pr(n);
map<string, int> m;
for (int i = 0; i < n; i++) {
string s, t;
cin >> s >> t;
if (m.find(s) == m.end()) m[s] = (int)m.size();
if (m.find(t) == m.end()) m[t] = (int)m.size();
assert(s == t);
pr[m[s]] = m[t];
}
cout << n;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |