Submission #280475

#TimeUsernameProblemLanguageResultExecution timeMemory
280475amallaWerewolf (IOI18_werewolf)C++17
0 / 100
4054 ms22264 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]; for (int i = 0; i<N; ++i) { adj[Y[i]].push_back(X[i]); adj[X[i]].push_back(Y[i]); } vector<int> vis(N, -1); for (int i = 0; i < Q; ++i) { bool can_make = 0; queue<Progress> q; q.push({S[i],1}); while(!q.empty()) { Progress curr = q.front(); q.pop(); if (curr.is_human && curr.city<L[i]) continue; if (curr.is_human==0 && curr.city>R[i]) continue; if (curr.is_human==0 && curr.city==E[i]) { can_make = 1; break; } for (auto e : adj[curr.city]) { if (vis[e]==i) continue; vis[e] = i; q.push({e, curr.is_human}); if (L[i]<=e && e<=R[i] && curr.is_human) q.push({e, 0}); } } A[i] = can_make; } 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...