# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
435165 |
2021-06-23T04:38:45 Z |
Apiram |
Werewolf (IOI18_werewolf) |
C++14 |
|
4000 ms |
524292 KB |
#include<bits/stdc++.h>
#include "werewolf.h"
using namespace std;
vector<vector<int>>adj(2e5 + 5);
bool ok;
void dfs (int s,int par,int l,int r,int e){
if (ok)return;
if (s==e){
ok=true;
return;
}
for (auto x:adj[s]){
if (x>=l&&x<=r&&x!=par){
dfs(x,s,l,r,e);
}
}
}
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) {
vector<int>A(E.size());
for (int i =0;i<X.size();++i){
adj[X[i]].push_back(Y[i]);
adj[Y[i]].push_back(X[i]);
}
//0 - human
//1 - wolf
for (int i =0;i<E.size();++i){
for (int j =L[i];j<=R[i];++j){
ok=false;
dfs(j,-1,0,R[i],E[i]);
A[i]=ok;
ok=false;
dfs(s[i],-1,L[i],N-1,j);
A[i]&=ok;
if (A[i])break;
}
}
return A;
}
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:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for (int i =0;i<X.size();++i){
| ~^~~~~~~~~
werewolf.cpp:28:18: 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<E.size();++i){
| ~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
407 ms |
524292 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
407 ms |
524292 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4067 ms |
21516 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
407 ms |
524292 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |