#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
using vi = vector<int>;
const int mxN = (int)2e5+10;
int n, m, q;
bool vis[mxN];
vi adj[mxN];
bool dfs(int s, int t, int l, int r){
vis[s] = 1; if(s==t) return 1;
for(auto u : adj[s]){
if(vis[u]) continue;
if(u<n and u<l) continue;
if(u>=n and u-n>r) continue;
if(s>=n and u<n) continue;
if(dfs(u,t,l,r)) return 1;
}
return false;
}
vi check_validity(int N, vi U, vi V, vi S, vi T, vi L, vi R) {
n = N, m = sz(U), q = sz(S); vi ans(q, 0);
for(int i = 0; i < m; i++){
int a = U[i], b = V[i];
adj[a].pb(b); adj[b].pb(a); a+=n, b+=n;
adj[a].pb(b); adj[b].pb(a); a-=n, b-=n;
adj[a].pb(a+n); adj[b].pb(b+n);
}
for(int i = 0; i < q; i++){
fill(vis,vis+2*n,0);
ans[i] = dfs(S[i],T[i]+n,L[i],R[i]);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
2 ms |
5008 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
3 ms |
5008 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
5008 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
2 ms |
5008 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
3 ms |
5008 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
5008 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
104 ms |
5520 KB |
Output is correct |
11 |
Correct |
74 ms |
5460 KB |
Output is correct |
12 |
Correct |
13 ms |
5552 KB |
Output is correct |
13 |
Correct |
82 ms |
5516 KB |
Output is correct |
14 |
Correct |
70 ms |
5460 KB |
Output is correct |
15 |
Correct |
189 ms |
5840 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
102 ms |
38972 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
2 ms |
5008 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
3 ms |
5008 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
5008 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
104 ms |
5520 KB |
Output is correct |
11 |
Correct |
74 ms |
5460 KB |
Output is correct |
12 |
Correct |
13 ms |
5552 KB |
Output is correct |
13 |
Correct |
82 ms |
5516 KB |
Output is correct |
14 |
Correct |
70 ms |
5460 KB |
Output is correct |
15 |
Correct |
189 ms |
5840 KB |
Output is correct |
16 |
Runtime error |
102 ms |
38972 KB |
Execution killed with signal 11 |
17 |
Halted |
0 ms |
0 KB |
- |