# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
816412 |
2023-08-09T05:01:12 Z |
ttamx |
Werewolf (IOI18_werewolf) |
C++14 |
|
156 ms |
19672 KB |
#include "werewolf.h"
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> p2;
const int N=3005;
int n,m,q;
vector<int> adj[N];
int vis[N],vis2[N];
void dfs(int u,int l){
if(vis[u])return;
vis[u]=true;
for(auto v:adj[u]){
if(v<l)continue;
dfs(v,l);
}
}
bool dfs2(int u,int r){
if(vis2[u])return false;
vis2[u]=true;
if(vis[u])return true;
for(auto v:adj[u]){
if(r<v)continue;
if(dfs2(v,r))return true;
}
return false;
}
vector<int> check_validity(int _n,vector<int> X,vector<int> Y,vector<int> S,vector<int> E,vector<int> L,vector<int> R) {
n=_n;
m=X.size();
q=S.size();
for(int i=0;i<m;i++){
int u=X[i],v=Y[i];
adj[u].emplace_back(v);
adj[v].emplace_back(u);
}
vector<int> ans(q);
for(int i=0;i<q;i++){
int s=S[i],e=E[i],l=L[i],r=R[i];
for(int i=0;i<n;i++)vis[i]=vis2[i]=false;
dfs(s,l);
ans[i]=dfs2(e,r);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
372 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
380 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 |
372 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
380 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 |
106 ms |
748 KB |
Output is correct |
11 |
Correct |
60 ms |
740 KB |
Output is correct |
12 |
Correct |
9 ms |
824 KB |
Output is correct |
13 |
Correct |
111 ms |
756 KB |
Output is correct |
14 |
Correct |
72 ms |
732 KB |
Output is correct |
15 |
Correct |
156 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
93 ms |
19672 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 |
372 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
380 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 |
106 ms |
748 KB |
Output is correct |
11 |
Correct |
60 ms |
740 KB |
Output is correct |
12 |
Correct |
9 ms |
824 KB |
Output is correct |
13 |
Correct |
111 ms |
756 KB |
Output is correct |
14 |
Correct |
72 ms |
732 KB |
Output is correct |
15 |
Correct |
156 ms |
888 KB |
Output is correct |
16 |
Runtime error |
93 ms |
19672 KB |
Execution killed with signal 11 |
17 |
Halted |
0 ms |
0 KB |
- |