#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int par1[200000], par2[200000];
int find1(int u) { return par1[u] == u ? u : find1(par1[u]); }
int find2(int u) { return par2[u] == u ? u : find2(par2[u]); }
vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R)
{
int Q = S.size(), M = X.size();
vector<int> A(Q, 0);
for (int i = 0; i < N; i++)
par1[i] = par2[i] = i;
vector<vector<int>> g(N);
for (int i = 0; i < M; i++)
{
g[X[i]].push_back(Y[i]);
g[Y[i]].push_back(X[i]);
}
for (int u = 0; u < N; u++)
for (int v : g[u])
if (v < u)
par1[find1(v)] = u;
for (int u = N - 1; u >= 0; u--)
for (int v : g[u])
if (v > u)
par2[find2(v)] = u;
return A;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
144 ms |
23020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |