急にVisual Studio 2012 RCでデバッグ実行ができなくなって焦りました。
int main() { std::ios::sync_with_stdio(false); int N; cin >> N; UnionFind uf(N); vector<pair<int, int> > snowDrifts; REP(n, N) { int x, y; cin >> x >> y; REP(i, n) { if (snowDrifts[i].first == x || snowDrifts[i].second == y) { uf.unionSet(i, n); } } snowDrifts.push_back(MP(x, y)); } set<int> roots; REP(n, N) { roots.insert(uf.root(n)); } cout << roots.size() - 1 << endl; }
読んでいません
読んでいません
読んでいません
# | Who | = | * | A 500 | B 1000 | C 2500 | D 3000 | E 3000 |
119 | nodchip | 492 | 0 | + 00:04-1 |
1989->1982 Aのおかげで命拾いしました。