제출 #949356

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9493562024-03-19 06:55:35IBory다리 (APIO19_bridges)C++17
100 / 100
1606 ms13176 KiB
#include <bits/stdc++.h>
#define pii pair<int, int>
using namespace std;
const int MAX = 100007, BUCKET = 1000;
int R[MAX], Z[MAX], L[MAX], ans[MAX], sq;
pii E[MAX];
stack<pii> ST;
vector<pii> upd[MAX];
int Find(int n) {
if (n == R[n]) return n;
return Find(R[n]);
}
void Union(int a, int b, bool save = 0) {
a = Find(a), b = Find(b);
if (a == b) return;
if (Z[a] < Z[b]) swap(a, b);
Z[a] += Z[b];
R[b] = a;
if (save) ST.emplace(a, b);
}
void Rollback() {
while (!ST.empty()) {
auto [a, b] = ST.top(); ST.pop();
Z[a] -= Z[b];
R[b] = b;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...