#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
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 m=x.size(),q=s.size();
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]);
}
vector <int> res;
for (int i=0; i<q; i++){
bool visited[n];
for (int j=0; j<n; j++) visited[i]=0;
queue <int> q;
if (s[i]>=l[i]){
q.push(s[i]);
visited[s[i]]=1;
}
while (!q.empty()){
int t=q.front();
q.pop();
for (auto&j:g[t]){
if (j>=l[i]&&!visited[j]){
q.push(j);
visited[j]=1;
}
}
}
for (int j=0; j<n; j++){
if (!visited[j]) continue;
bool vis[n];
for (int k=0; k<n; k++) vis[k]=0;
queue <int> u;
if (j<=r[i]){
u.push(j);
vis[j]=1;
}
while (!u.empty()){
int t=u.front();
u.pop();
if (t==e[i]){
res.push_back(1);
goto die;
}
for (auto&k:g[t]){
if (k<=r[i]&&!vis[k]){
u.push(k);
vis[k]=1;
}
}
}
}
res.push_back(0);
die:;
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4100 ms |
21100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |