#include "werewolf.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> edge[3005];
bool visited[3005][3], ok;
void dfs(int node, int lim, int type) {
visited[node][type] = 1;
if(type == 1 && visited[node][0] == 1) ok = 1;
if(ok == 1) return;
for(auto x: edge[node]) {
if(type == 0) {
if(x >= lim && visited[x][type] == 0) dfs(x, lim, type);
}
else {
if(x <= lim && visited[x][type] == 0) dfs(x, lim, type);
}
}
}
vector<int > v;
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) {
for(int i = 0; i < X.size(); i ++) {
edge[X[i]].pb(Y[i]);
edge[Y[i]].pb(X[i]);
}
for(int i = 0; i < S.size(); i ++) {
memset(visited, 0, sizeof(visited));
memset(visited, 0, sizeof(visited));
ok = 0;
dfs(S[i], L[i], 0);
dfs(E[i], R[i], 1);
if(ok == 1) v.pb(1);
else v.pb(0);
}
return v;
}
Compilation message
werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
28 | for(int i = 0; i < X.size(); i ++) {
| ~~^~~~~~~~~~
werewolf.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | for(int i = 0; i < S.size(); i ++) {
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
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 |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
155 ms |
668 KB |
Output is correct |
11 |
Correct |
78 ms |
616 KB |
Output is correct |
12 |
Correct |
11 ms |
724 KB |
Output is correct |
13 |
Correct |
161 ms |
676 KB |
Output is correct |
14 |
Correct |
96 ms |
612 KB |
Output is correct |
15 |
Correct |
197 ms |
796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
164 ms |
19688 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
155 ms |
668 KB |
Output is correct |
11 |
Correct |
78 ms |
616 KB |
Output is correct |
12 |
Correct |
11 ms |
724 KB |
Output is correct |
13 |
Correct |
161 ms |
676 KB |
Output is correct |
14 |
Correct |
96 ms |
612 KB |
Output is correct |
15 |
Correct |
197 ms |
796 KB |
Output is correct |
16 |
Runtime error |
164 ms |
19688 KB |
Execution killed with signal 11 |
17 |
Halted |
0 ms |
0 KB |
- |