이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
int n,m,q,mn,mx;
vector<int> adj[N];
bool visited[N];
int val[N];
void dfs(int u)
{
if(visited[u]) return;
val[u]++;
visited[u] = true;
for(int v : adj[u]) if(v>=mn and v<=mx) dfs(v);
}
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 a = x[i],b = y[i];
adj[a].push_back(b);
adj[b].push_back(a);
}
vector<int> ans;
for(int i = 0;i < q;i++)
{
mn = l[i],mx = n-1;
for(int j = 0;j < n;j++) visited[j] = false,val[j] = 0;
dfs(s[i]);
mn = 0,mx = r[i];
for(int j = 0;j < n;j++) visited[j] = false;
dfs(e[i]);
bool ok = false;
for(int j = 0;j < n;j++) if(val[j]==2) ok = true;
ans.push_back(ok);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |