Submission #116235

#TimeUsernameProblemLanguageResultExecution timeMemory
116235mirbek01Werewolf (IOI18_werewolf)C++11
0 / 100
4089 ms29096 KiB
# include <bits/stdc++.h> # include "werewolf.h" using namespace std; const int N = 4e5 + 2; vector <int> g[N]; 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(); int m = X.size(); vector <int> A(q); for(int i = 0; i < m; i ++){ g[X[i]].push_back(Y[i]); g[Y[i]].push_back(X[i]); } for(int i = 0; i < q; i ++){ queue <int> qe; vector <int> d(N, 0), used(N, 0); qe.push(S[i]); used[S[i]] = 1; d[S[i]] = 1; while(!qe.empty()){ int v = qe.front(); qe.pop(); for(int to : g[v]){ if(used[to] || to < L[i]) continue; used[to] = 1; d[to] ++; qe.push(to); } } for(int j = 0; j < N; j ++) used[j] = 0; qe.push(E[i]); used[E[i]] = 1; d[E[i]] = 1; while(!qe.empty()){ int v = qe.front(); qe.pop(); for(int to : g[v]){ if(used[to] || to > R[i]) continue; used[to] = 1; d[to] ++; qe.push(to); } } for(int j = 0; j < N; j ++){ if(d[j] == 2) A[i] = 1; } } return A; } /*** 6 6 3 5 1 1 2 1 3 3 4 3 0 5 2 4 2 1 2 4 2 2 2 5 4 3 4 ****/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...