#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> g[200000];
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();
for (int i=0; i<m; i++){
g[x[i]].push_back(y[i]);
g[y[i]].push_back(x[i]);
}
vector <int> ans;
for (int i=0; i<q; i++){
bool visited[n];
for (int j=0; j<n; j++) visited[j]=0;
vector <int> cango;
queue <int> q;
if (s[i]>=l[i]){
q.push(s[i]);
visited[s[i]]=1;
cango.push_back(s[i]);
}
while (!q.empty()){
int t=q.front();
q.pop();
for (auto&j:g[t]){
if (!visited[j]&&j>=l[i]){
q.push(j);
cango.push_back(j);
visited[j]=1;
}
}
}
for (auto&j:cango){
//from j to e[i]
for (int k=0; k<n; k++) visited[i]=0;
queue <int> q;
if (j<=r[i]){
q.push(j);
visited[j]=1;
}
while (!q.empty()){
int t=q.front();
q.pop();
if (t==e[i]){
ans.push_back(1);
goto die;
}
for (auto&k:g[t]){
if (!visited[k]&&k<=r[i]){
q.push(k);
visited[k]=1;
}
}
}
}
ans.push_back(0);
die:;
cango.clear();
while (!q.empty()) q.pop();
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4972 KB |
Output is correct |
2 |
Correct |
4 ms |
4972 KB |
Output is correct |
3 |
Runtime error |
10 ms |
9964 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4972 KB |
Output is correct |
2 |
Correct |
4 ms |
4972 KB |
Output is correct |
3 |
Runtime error |
10 ms |
9964 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4050 ms |
22792 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4972 KB |
Output is correct |
2 |
Correct |
4 ms |
4972 KB |
Output is correct |
3 |
Runtime error |
10 ms |
9964 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |