제출 #1208424

#제출 시각아이디문제언어결과실행 시간메모리
1208424AvianshWerewolf (IOI18_werewolf)C++20
15 / 100
4091 ms29784 KiB
#include "werewolf.h" #include <bits/stdc++.h> using namespace std; void dfsh(int st, vector<int>g[], bool vis[], int lim){ vis[st]=1; for(int i : g[st]){ if(vis[i]||i<lim) continue; dfsh(i,g,vis,lim); } } void dfsw(int st, vector<int>g[], bool vis[], int lim){ vis[st]=1; for(int i : g[st]){ if(vis[i]||i>lim) continue; dfsw(i,g,vis,lim); } } vector<int> check_validity(int n, vector<int> x, vector<int> y, vector<int> s, vector<int> e,vector<int> l, vector<int> r) { int q = s.size(); vector<int>g[n]; int m = x.size(); for(int i = 0;i<m;i++){ g[x[i]].push_back(y[i]); g[y[i]].push_back(x[i]); } vector<int>ans(q); for(int i = 0;i<q;i++){ bool vish[n]; fill(vish,vish+n,0); bool visw[n]; fill(visw,visw+n,0); dfsh(s[i],g,vish,l[i]); dfsw(e[i],g,visw,r[i]); ans[i]=0; for(int j = 0;j<n;j++){ if(vish[j]&&visw[j]) ans[i]=1; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...