版本比较
P6691 选择题 题解
正文
增加 1 行删除 1 行
32 行未改动333435363737383940414 行未改动32 行未改动 int res = 1, mx = 0, mn = 0; for (int i = 1; i <= n; i++) (find(i) == i) && (res = res * 2 % MD); for (int i = 1; i <= n; i++) cnt[find(i)][0]++, cnt[find(i + n)][1]++; // 记录相对正确/错误的点的个数 for (int i = 1; i <= n; i++) for (int i = 1; i <= n; i++) if (find(i) == i) mx += max(cnt[i][0], cnt[i][1]), // 如果根是正确的就选 cnt[i][0],反之亦然 mn += min(cnt[i][0], cnt[i][1]); // 那么取最值即可 cout << res << '\n' << mx << '\n' << mn << '\n';4 行未改动