#include "werewolf.h"
#include<bits/stdc++.h>
#define pb push_back
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();
int M=X.size();
vector<int> ans;
for(int ind=0; ind <Q; ++ind){
vector<bool> vis(2*N, 0);
int l=L[ind];
int r=R[ind];
vector<vector<int>> adj (2*N);
for(int i=0; i<M; ++i){
if(X[i]>=l && Y[i]>=l){
adj[X[i]].pb(Y[i]);
adj[Y[i]].pb(X[i]);
}
if(X[i]<=r && Y[i]<=r){
adj[X[i]+N].pb(Y[i]+N);
adj[Y[i]+N].pb(X[i]+N);
}
}
for(int i=l; i<=r; ++i){
adj[i].pb({i+N});
}
queue<int> q;
q.push(S[ind]);
vis[S[ind]]=true;
while(!q.empty()){
int x=q.front();
q.pop();
for(int y: adj[x]){
if(!vis[y]){
vis[y]=true;
q.push(y);
}
}
}
ans.pb(vis[E[ind]+N]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
2 ms |
348 KB |
Output is correct |
10 |
Correct |
1251 ms |
1208 KB |
Output is correct |
11 |
Correct |
1180 ms |
972 KB |
Output is correct |
12 |
Correct |
934 ms |
1204 KB |
Output is correct |
13 |
Correct |
1243 ms |
968 KB |
Output is correct |
14 |
Correct |
1137 ms |
968 KB |
Output is correct |
15 |
Correct |
2215 ms |
1184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4022 ms |
31660 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
2 ms |
348 KB |
Output is correct |
10 |
Correct |
1251 ms |
1208 KB |
Output is correct |
11 |
Correct |
1180 ms |
972 KB |
Output is correct |
12 |
Correct |
934 ms |
1204 KB |
Output is correct |
13 |
Correct |
1243 ms |
968 KB |
Output is correct |
14 |
Correct |
1137 ms |
968 KB |
Output is correct |
15 |
Correct |
2215 ms |
1184 KB |
Output is correct |
16 |
Execution timed out |
4022 ms |
31660 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |