QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#796695 | #9743. 重心树 | JEdward | Compile Error | / | / | C++20 | 786b | 2024-12-02 00:00:56 | 2024-12-02 00:00:56 |
Judging History
This is the latest submission verdict.
- [2024-12-02 00:00:56]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-12-02 00:00:56]
- Submitted
answer
#include<bits/stdc++.h
using std::cin, std::cout;
using ll = long long;
using u64 = unsigned long long;
using db = double;
const int N = 200005;
int anc[N];
int find(int x) {
return anc[x] == x ? x : anc[x] = find(anc[x]);
}
void solve() {
int n;
cin >> n;
std::vector<std::vector<int>> o(n + 1);
for(int i = 1;i <= n;++i) {
int c; cin >> c;
o[i].resize(c);
for(int & x : o[i]) cin >> x;
}
std::vector<std::pair<int, int>> ans;
for(int i = n;i >= 1;--i) {
anc[i] = i;
for(int y : o[i]) {
int z = find(y);
ans.emplace_back(i, z);
anc[z] = i;
}
}
for(auto [x, y] : ans) {
cout << x << ' ' << y << '\n';
}
}
int main() {
std::ios::sync_with_stdio(false), cin.tie(0);
int t;
cin >> t;
while(t--) {
solve();
}
}
Details
answer.code:1:23: error: missing terminating > character 1 | #include<bits/stdc++.h | ^