Submission #77625

#TimeUsernameProblemLanguageResultExecution timeMemory
77625Just_Solve_The_ProblemWerewolf (IOI18_werewolf)C++11
15 / 100
341 ms20516 KiB
#include <bits/stdc++.h> #include "werewolf.h" // #include "grader.cpp" #define pb push_back using namespace std; const int N = 6e3 + 7; int was[N]; int used[N]; vector < int > gr[N]; int l, r; int n; void dfs1(int v, int pr) { was[v]++; used[v] = 1; for (int to : gr[v]) { if (!used[to] && to >= l) dfs1(to, v); } } void dfs2(int v, int pr) { was[v]++; used[v] = 1; for (int to : gr[v]) { if (!used[to] && to <= r) dfs2(to, v); } } vector < int > check_validity(int N, vector < int > X, vector < int > Y, vector < int > S, vector < int > E, vector < int > L, vector < int > R) { n = N; for (int i = 0; i < (int)X.size(); i++) { gr[X[i]].pb(Y[i]); gr[Y[i]].pb(X[i]); } vector < int > ans; int q = S.size(); for (int i = 0; i < q; i++) { l = L[i]; r = R[i]; memset(was, 0, sizeof was); dfs1(S[i], S[i]); memset(used, 0, sizeof used); dfs2(E[i], E[i]); memset(used, 0, sizeof used); int ok = 1; for (int j = l; j <= r; j++) { if (was[j] == 2) { ans.pb(1); ok = 0; break; } } if (ok) { ans.pb(0); } } 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...