Submission #280531

#TimeUsernameProblemLanguageResultExecution timeMemory
280531amallaWerewolf (IOI18_werewolf)C++17
0 / 100
4056 ms40824 KiB
#include "werewolf.h" #include<bits/stdc++.h> using namespace std; typedef vector<int> VI; typedef vector<bool> VB; struct Progress { int city; bool is_human; }; vector<int> check_validity(int N, VI X, VI Y, VI S, VI E, VI L, VI R) { int Q = S.size(); VI A(Q); VI adj[N]; int M = X.size(); for (int i = 0; i<M; ++i) { adj[Y[i]].push_back(X[i]); adj[X[i]].push_back(Y[i]); } vector<vector<int> > vis(N, vector<int>(2,-1)); for (int i = 0; i < Q; ++i) { A[i] = 0; queue<Progress> q; q.push({S[i],1}); vis[S[i]][1] = i; while(!q.empty()) { Progress curr = q.front(); q.pop(); if (curr.is_human==0 && curr.city==E[i]) { A[i] = 1; break; } if (curr.is_human && curr.city<L[i]) continue; if (curr.is_human==0 && curr.city>R[i]) continue; for (auto e : adj[curr.city]) { if (vis[e][curr.is_human]==i) continue; vis[e][curr.is_human] = i; q.push({e, curr.is_human}); if (L[i]<=e && e<=R[i] && curr.is_human) { vis[e][0] = i; q.push({e, 0}); } } } } return A; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...