# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1043006 | XJP12 | 늑대인간 (IOI18_werewolf) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi ;
vvi g;
bitset<200005> vis;
bitset<200005> vis1;
bool ban=false;
void dfs2(int u, int l){
if(u>l) return;
vis1[u]=true;
if(vis[u]==true && vis1[u]==true){
ban=true;
}
for(auto v: g[u]){
if(!vis1[v]){
dfs2(v,l);
}
}
}
void dfs1(int u, int l){
if(u<l) return;
vis[u]=true;
for(auto v: g[u]){
if(!vis[v]){
dfs1(v,l);
}
}
}
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++){
vis.reset();
vis1.reset();
bam==false;
dfs1(s[i], l[i]);
dfs2(e[i], r[i]);
if(ban){
ans[i]=1;
}
}
return ans;
}