# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
600839 | 2022-07-21T08:12:05 Z | enerelt14 | Werewolf (IOI18_werewolf) | C++14 | 129 ms | 19672 KB |
#include "werewolf.h" #include<bits/stdc++.h> #define pb push_back using namespace std; bool vis[3005], is[3005]; vector<int>adj[3005]; void dijkstra1(int s, int l){ queue<int>pq; pq.push(s); while(!pq.empty()){ int u=pq.front(); pq.pop(); vis[u]=1; for (int i=0;i<adj[u].size();i++){ if (adj[u][i]<l || vis[adj[u][i]])continue; pq.push(adj[u][i]); } while(!pq.empty() && vis[pq.front()])pq.pop(); } } void dijkstra2(int s, int r){ queue<int>pq; pq.push(s); while(!pq.empty()){ int u=pq.front(); pq.pop(); vis[u]=1; for (int i=0;i<adj[u].size();i++){ if (adj[u][i]>r || vis[adj[u][i]])continue; pq.push(adj[u][i]); } while(!pq.empty() && vis[pq.front()])pq.pop(); } } vector<int>check_validity(int N,vector<int>X,vector<int>Y,vector<int>S,vector<int>E,vector<int>L,vector<int>R){ for (int i=0;i<X.size();i++){ adj[X[i]].pb(Y[i]); adj[Y[i]].pb(X[i]); } int Q=S.size(); vector<int>ans; for (int j=0;j<Q;j++){ ans[j]=0; if (S[j]<L[j] || E[j]>R[j])continue; for (int i=L[j];i<N;i++)vis[i]=0; dijkstra1(S[j], L[j]); for (int i=L[j];i<=R[j];i++)is[i]=vis[i]; for (int i=0;i<=R[j];i++)vis[i]=0; dijkstra2(E[j], R[j]); for (int i=L[j];i<=R[j];i++){ if (vis[i] && is[i]){ ans[j]=1; break; } } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 129 ms | 19672 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |