#include "werewolf.h"
#include "bits/stdc++.h"
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
const int INF = 1e9;
vi check_validity(int N, vi X, vi Y, vi S, vi E, vi L, vi R)
{
vvi adj = vvi(N);
for (int i = 0; i < N; i++)
{
adj[X[i]].push_back(Y[i]);
adj[Y[i]].push_back(X[i]);
}
int Q = S.size();
vi ans(Q);
for (int i = 0; i < Q; i++)
{
vector<bool> visited(N, false);
queue<int> q;
q.push(S[i]);
visited[S[i]] = true;
while (!q.empty())
{
int cur = q.front();
q.pop();
if (cur < L[i])
continue;
vector<bool> visitedWOLF(N, false);
queue<int> qWOLF;
qWOLF.push(cur);
visitedWOLF[cur] = true;
while (!qWOLF.empty())
{
int curWOLF = qWOLF.front();
qWOLF.pop();
if (curWOLF > R[i])
continue;
if (curWOLF == E[i])
ans[i] = true;
for (int a : adj[curWOLF])
{
if (visitedWOLF[a])
continue;
qWOLF.push(a);
visitedWOLF[a] = true;
}
}
for (int a : adj[cur])
{
if (visited[a])
continue;
q.push(a);
visited[a] = true;
}
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4057 ms |
29824 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |