# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1018351 | 2024-07-09T19:30:03 Z | vjudge1 | Werewolf (IOI18_werewolf) | C++17 | 0 ms | 0 KB |
#include "werewolf.h" #include <bits/stdc++.h> #define pb push_back #define rep(a,b,c) for(int a=b; a<c; a++) #define repa(a,b) for(auto a:b) using namespace std; 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(), M=X.size(); if(N>3000 || M>6000 || Q>3000){ return {}; } vector<int> adj[N], A; rep(i,0,M){ adj[X[i]].pb(Y[i]); adj[Y[i]].pb(X[i]); } queue<int> q; rep(i,0,Q){ bool vis[N][2]{}; if(S[i]>=l[i]){ q.push(S[i]); q.push(0); } while(q.size()){ int u=q.front(); q.pop(); int z=q.front(); q.pop(); repa(v,adj[u]){ if(!z && v>=L[i] && !vis[v][z]){ vis[v][z]=true; q.push(v); q.push(z); } if(z && v<=R[i] && !vis[v][z]){ vis[v][z]=true; q.push(v); q.push(z); } if(!z && L[i]<=v && R[i]>=v){ vis[v][1]=true; q.push(v); q.push(1); } } } A.pb(vis[E[i]][1]); } return A; }