#include "werewolf.h"
#include <bits/stdc++.h>
#define pb push_back
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)
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 Q=S.size(), M=X.size();
if(N>3000 || M>6000 || Q>3000){
return {};
}
vector<int> adj[N], A;
rep(i,0,M){
adj[X[i]].pb(Y[i]);
adj[Y[i]].pb(X[i]);
}
queue<int> q;
rep(i,0,Q){
bool vis[N][2]{};
if(S[i]>=L[i]){
q.push(S[i]);
q.push(0);
}
while(q.size()){
int u=q.front();
q.pop();
int z=q.front();
q.pop();
repa(v,adj[u]){
if(!z && v>=L[i] && !vis[v][z]){
vis[v][z]=true;
q.push(v);
q.push(z);
}
if(z && v<=R[i] && !vis[v][z]){
vis[v][z]=true;
q.push(v);
q.push(z);
}
}
if(!z && L[i]<=u && R[i]>=u && !vis[u][1]){
vis[u][1]=true;
q.push(u);
q.push(1);
}
}
A.pb(vis[E[i]][1]);
}
return A;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
260 ms |
860 KB |
Output is correct |
11 |
Correct |
159 ms |
848 KB |
Output is correct |
12 |
Correct |
10 ms |
860 KB |
Output is correct |
13 |
Correct |
209 ms |
1096 KB |
Output is correct |
14 |
Correct |
132 ms |
860 KB |
Output is correct |
15 |
Correct |
174 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
111 ms |
16744 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
260 ms |
860 KB |
Output is correct |
11 |
Correct |
159 ms |
848 KB |
Output is correct |
12 |
Correct |
10 ms |
860 KB |
Output is correct |
13 |
Correct |
209 ms |
1096 KB |
Output is correct |
14 |
Correct |
132 ms |
860 KB |
Output is correct |
15 |
Correct |
174 ms |
856 KB |
Output is correct |
16 |
Incorrect |
111 ms |
16744 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |