Submission #1105142

#TimeUsernameProblemLanguageResultExecution timeMemory
1105142thelegendary08Werewolf (IOI18_werewolf)C++14
15 / 100
4033 ms29888 KiB
#include "werewolf.h" #include<bits/stdc++.h> #define f0r(i,n) for(int i = 0; i<n; i++) #define pb push_back using namespace std; 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) { int Q = S.size(); int m = X.size(); vector<int>adj[N]; f0r(i, m){ adj[X[i]].pb(Y[i]); adj[Y[i]].pb(X[i]); } vector<int>ans(Q); f0r(t, Q){ int s = S[t]; int e = E[t]; int l = L[t]; int r = R[t]; vector<bool>vis(N, 0); vector<bool>wis(N, 0); queue<int>q; if(s >= l){ vis[s] = 1; q.push(s); } while(!q.empty()){ int node = q.front(); q.pop(); for(auto u : adj[node]){ if(vis[u])continue; if(u < l)continue; vis[u] = 1; q.push(u); } } if(e <= r){ wis[e] = 1; q.push(e); } while(!q.empty()){ int node = q.front(); q.pop(); for(auto u : adj[node]){ if(wis[u])continue; if(u > r)continue; wis[u] = 1; q.push(u); } } int a = 0; f0r(i,N){ if(vis[i] && wis[i])a = 1; } ans[t] = a; } 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...