# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1042976 |
2024-08-03T16:28:30 Z |
XJP12 |
Werewolf (IOI18_werewolf) |
C++14 |
|
4000 ms |
22704 KB |
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi ;
vvi g;
bitset<200005> vis;
bool ban=false;
bool hw=false;
void dfs(int u, int l, int r, int j, int fin){
vis[u]=true;
if(u==j && u<=r){
ban=true;
}
if(u==fin && ban==true){
hw=true;
}
for(auto v: g[u]){
if(u==j && u>r) break;
if(!vis[v]){
if(!ban){
if(v>=l) dfs(v,l,r,j, fin);
}else{
if(v<=r) dfs(v,l,r,j, fin);
}
}
}
if(u==j){
ban=false;
}
}
vi check_validity(int n, vi x, vi y, vi s, vi e, vi l, vi r){
int m = (int)x.size();
int q = (int)e.size();
vi ans(q,0);
g.resize(n, vi());
for(int i=0; i<m; i++){
g[x[i]].push_back(y[i]);
g[y[i]].push_back(x[i]);
}
for(int i=0; i<q; i++){
for(int j=0; j<n; j++){
ban=false;
hw=false;
vis.reset();
dfs(s[i], l[i], r[i], j, e[i]);
if(vis[e[i]]==true && hw==true){
ans[i]=1;
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
6 ms |
476 KB |
Output is correct |
6 |
Correct |
7 ms |
472 KB |
Output is correct |
7 |
Correct |
6 ms |
348 KB |
Output is correct |
8 |
Correct |
4 ms |
348 KB |
Output is correct |
9 |
Correct |
4 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
6 ms |
476 KB |
Output is correct |
6 |
Correct |
7 ms |
472 KB |
Output is correct |
7 |
Correct |
6 ms |
348 KB |
Output is correct |
8 |
Correct |
4 ms |
348 KB |
Output is correct |
9 |
Correct |
4 ms |
348 KB |
Output is correct |
10 |
Execution timed out |
4011 ms |
1396 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4067 ms |
22704 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
6 ms |
476 KB |
Output is correct |
6 |
Correct |
7 ms |
472 KB |
Output is correct |
7 |
Correct |
6 ms |
348 KB |
Output is correct |
8 |
Correct |
4 ms |
348 KB |
Output is correct |
9 |
Correct |
4 ms |
348 KB |
Output is correct |
10 |
Execution timed out |
4011 ms |
1396 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |