#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
#define vi vector <int>
vector <bool> visd(3003, 0);
vector <int> g[3003];
bool ok = 0;
void check(int u, int p, bool state, int l, int r, int e, vector <bool> vis){
if(u == e){
if(state==0 || r >= p || (u <= r && u >= l)){
ok = 1;
}
return;
}
if(vis[u] && e != u)
return;
if(state){
if(u < l)
if(r >= p && u <= r)
state = 0;
else
return;
}
else{
if(u > r)
return;
}
vis[u] = 1;
for(auto v : g[u]){
if(v == p)
continue;
// cout << v << " " << u << " " << state << "\n";
vector <bool> viss;
viss = vis;
check(v, u, state, l, r, e, viss);
}
}
vi check_validity(int n, vi x, vi y, vi s, vi e, vi L, vi R) {
int m = x.size();
for(int i = 0; i < m; i ++){
g[x[i]].push_back(y[i]);
g[y[i]].push_back(x[i]);
}
int q = s.size();
vector <int> ans;
for(int i = 0; i < q; i ++){
ok = 0;
check(s[i], s[i], 1, L[i], R[i], e[i], visd);
ans.push_back(ok);
}
return ans;
}
Compilation message
werewolf.cpp: In function 'void check(int, int, bool, int, int, int, std::vector<bool>)':
werewolf.cpp:19:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
19 | if(u < l)
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4043 ms |
416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4043 ms |
416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
159 ms |
19652 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4043 ms |
416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |