# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
289661 | DanerZein | 늑대인간 (IOI18_werewolf) | C++14 | 4075 ms | 38196 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int l,r;
bitset<200010> vh,vw;
vector<vi> G;
set<int> h,w;
void dfs_human(int u){
if(u<l) return;
vh[u]=1;
h.insert(u);
for(auto &v:G[u]){
if(!vh[v]){
dfs_human(v);
}
}
vh[u]=0;
}
void dfs_wolf(int u){
if(u>r) return;
vw[u]=1;
w.insert(u);
for(auto &v:G[u]){
if(!vw[v]){
dfs_wolf(v);
}
}
vw[u]=0;
}
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) {
G.resize(N+1);
for(int i=0;i<X.size();i++){
int u=X[i],v=Y[i];
G[u].push_back(v);
G[v].push_back(u);
}
vector<int> res;
for(int i=0;i<S.size();i++){
h.clear();
w.clear();
l=L[i];
r=R[i];
dfs_human(S[i]);
dfs_wolf(E[i]);
bool sw=0;
for(auto &v:h){
if(binary_search(w.begin(),w.end(),v)){
sw=1;
break;
}
}
res.push_back(sw);
}
return res;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |