Submission #77619

#TimeUsernameProblemLanguageResultExecution timeMemory
77619Just_Solve_The_ProblemWerewolf (IOI18_werewolf)C++11
0 / 100
213 ms27904 KiB
#include <bits/stdc++.h> #include "werewolf.h" // #include "grader.cpp" #define pb push_back using namespace std; const int N = 3e3 + 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] != 1 && to >= l) dfs1(to, v); } } void dfs2(int v, int pr) { was[v]++; used[v] = 2; for (int to : gr[v]) { if (used[to] != 2 && 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 < n; 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); for (int j = l; j <= r; j++) { if (was[j] == 2) { ans.pb(1); break; } } if ((int)ans.size() == i) { 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...