Submission #999157

#TimeUsernameProblemLanguageResultExecution timeMemory
999157UnforgettableplWerewolf (IOI18_werewolf)C++17
15 / 100
4034 ms31600 KiB
#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 (stderr)

werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:12:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=0;i<X.size();i++){
      |                 ~^~~~~~~~~
werewolf.cpp:17:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i=0;i<S.size();i++){
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...