#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define pb push_back
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
const int maxn5 = 3e3 + 10;
const int lg = 20;
vector <int> adj[maxn5], ret;
bool mark[maxn5], mark2[maxn5];
int liml, limr, n;
void dfs(int v){
mark[v] = true;
for(auto u : adj[v]) if(u >= liml && u <= limr && !mark[u])
dfs(u);
}
std::vector<int> check_validity(int N, std::vector<int> x, std::vector<int> y,
std::vector<int> s, std::vector<int> e,
std::vector<int> l, std::vector<int> r) {
n = N;
int q = s.size();
int m = x.size();
for(int i = 0; i < m; i++){
adj[x[i]].pb(y[i]);
adj[y[i]].pb(x[i]);
}
for(int i = 0; i < q; i++){
liml = 0, limr = r[i];
memset(mark, false, sizeof mark);
dfs(e[i]);
for(int j = 0; j < n; j++)
mark2[j] = mark[j];
memset(mark, false, sizeof mark);
liml = l[i]; limr = n;
dfs(s[i]);
bool re = false;
for(int j = 0; j < n; j++)
re |= (mark[j] && mark2[j]);
ret.pb(re);
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
372 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
376 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
376 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
372 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
376 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
376 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
183 ms |
736 KB |
Output is correct |
11 |
Correct |
100 ms |
712 KB |
Output is correct |
12 |
Correct |
15 ms |
808 KB |
Output is correct |
13 |
Correct |
210 ms |
744 KB |
Output is correct |
14 |
Correct |
129 ms |
704 KB |
Output is correct |
15 |
Correct |
179 ms |
872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
100 ms |
19992 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
372 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
376 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
376 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
183 ms |
736 KB |
Output is correct |
11 |
Correct |
100 ms |
712 KB |
Output is correct |
12 |
Correct |
15 ms |
808 KB |
Output is correct |
13 |
Correct |
210 ms |
744 KB |
Output is correct |
14 |
Correct |
129 ms |
704 KB |
Output is correct |
15 |
Correct |
179 ms |
872 KB |
Output is correct |
16 |
Runtime error |
100 ms |
19992 KB |
Execution killed with signal 11 |
17 |
Halted |
0 ms |
0 KB |
- |