# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1009607 | 2024-06-27T16:53:58 Z | aaaaaarroz | Werewolf (IOI18_werewolf) | C++17 | 4000 ms | 31612 KB |
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(),x.end() std::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) { int n = N; vector<vector<int>> adj(n); for(int i=0;i<X.size();i++){ adj[X[i]].emplace_back(Y[i]); adj[Y[i]].emplace_back(X[i]); } vector<int> ans(S.size()); for(int i=0;i<S.size();i++){ priority_queue<pair<int,int>> q; vector<int> dists(n,-1); q.emplace(S[i],S[i]); vector<bool> visited(n); while(!q.empty()){ auto [dist,idx]=q.top();q.pop(); if(visited[idx])continue; visited[idx]=true; dists[idx] = dist; for(int&x:adj[idx])if(!visited[x])q.emplace(min(x,dist),x); } vector<int> diste(n,n); visited = vector<bool>(n); q.emplace(-E[i],E[i]); while(!q.empty()){ auto [dist,idx]=q.top();q.pop();dist=-dist; if(visited[idx])continue; visited[idx]=true; diste[idx] = dist; for(int&x:adj[idx])if(!visited[x])q.emplace(-max(x,dist),x); } for(int x=0;x<n;x++)if(dists[x]>=L[i] and diste[x]<=R[i])ans[i]=1; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 2 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 452 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 2 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 452 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1554 ms | 884 KB | Output is correct |
11 | Correct | 1254 ms | 856 KB | Output is correct |
12 | Correct | 464 ms | 856 KB | Output is correct |
13 | Correct | 1407 ms | 856 KB | Output is correct |
14 | Correct | 990 ms | 856 KB | Output is correct |
15 | Correct | 3041 ms | 984 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4029 ms | 31612 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 2 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 452 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1554 ms | 884 KB | Output is correct |
11 | Correct | 1254 ms | 856 KB | Output is correct |
12 | Correct | 464 ms | 856 KB | Output is correct |
13 | Correct | 1407 ms | 856 KB | Output is correct |
14 | Correct | 990 ms | 856 KB | Output is correct |
15 | Correct | 3041 ms | 984 KB | Output is correct |
16 | Execution timed out | 4029 ms | 31612 KB | Time limit exceeded |
17 | Halted | 0 ms | 0 KB | - |