void solve() {
int n, m;
std::cin >> n >> m;
std::vector<i64> a(n + 1);
while (m --) {
i64 tmp = rnd();
int u, v;
std::cin >> u >> v;
a[u] ^= tmp;
a[v] ^= tmp;
}
i64 t = 0;
int max = 0;
std::map<i64, int> mp;
for (int i = 1; i <= n; i ++) {
t ^= a[i];
mp[t] ++;
max = std::max(max, mp[t]);
}
std::cout << n - max << "n";
}
This is the code for solving the problem, but I don’t quite understand it. Can a friend give me a rough idea of the code. And where is the essence of this hash? Thank you for your help!
ditto
This is my first time asking on this platform, and my question is on it
New contributor
thanksyouhelpme is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.