Submission #410920

#TimeUsernameProblemLanguageResultExecution timeMemory
410920abdzagWerewolf (IOI18_werewolf)C++17
0 / 100
4048 ms29824 KiB
#include<bits/stdc++.h> #include<unordered_map> #define rep(i,a,b) for(int i=int(a);i<int(b);i++) #define rrep(i,a,b) for(int i=int(a);i>int(b);i--) #define all(v) v.begin(),v.end() #define trav(a,v) for(auto&a:v) #define sz(a) a.size() typedef long double ld; using namespace std; static const long long inf = 1e15; typedef long long ll; typedef unsigned long long ull; vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y, std::vector<int> S, std::vector<int> E, std::vector<int> L, std::vector<int> R) { vector < vector<ll>> g(N); rep(i, 0, X.size()) { g[X[i]].push_back(Y[i]); g[Y[i]].push_back(X[i]); } vector<int> ans(E.size()); rep(i, 0, E.size()) { queue<ll> q; vector<bool> visited(N); q.emplace(E[i]); if (E[i] <= L[i]) { ans[i] = 0; continue; } while (!q.empty()) { ll cur = q.front(); q.pop(); trav(v, g[cur]) { if (v > L[i] && !visited[v]) { visited[v] = 1; q.emplace(v); } } } vector<bool> visited2(N); q.emplace(S[i]); if (S[i] >= R[i]) { ans[i] = 0; continue; } while (!q.empty()) { ll cur = q.front(); q.pop(); trav(v, g[cur]) { if (v < R[i] && !visited2[v]) { if (visited[v]) { ans[i] = 1; break; } visited2[v] = 1; q.emplace(v); } } } } 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...