Submission #138903

#TimeUsernameProblemLanguageResultExecution timeMemory
138903HassoonyWerewolf (IOI18_werewolf)C++17
0 / 100
211 ms23788 KiB
#include <bits/stdc++.h> #include "werewolf.h" //#include "grader.cpp" using namespace std; const int MX=3009; int vis[MX][4],n; vector<int>v[MX]; vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R){ n=N; for(int i=0;i<X.size();i++){ v[X[i]].push_back(Y[i]); v[Y[i]].push_back(X[i]); } vector<int>ans; for(int i=0;i<S.size();i++){ for(int j=0;j<n;j++){ for(int k=0;k<3;k++){ vis[j][k]=0; } } int s=S[i],e=E[i],l=L[i],r=R[i]; priority_queue<pair<int,int> >pq; pq.push({0,s}); while(!pq.empty()){ int x=pq.top().second,type=pq.top().first;pq.pop(); if(type == 0){ if(x < l)continue; } if(type == 1){ if(x > r)continue; } if(vis[x][type])continue; vis[x][type]=1; if(type == 1){ for(auto pp:v[x]) pq.push({type,pp}); } else{ for(auto pp:v[x]){ pq.push({type,pp}); } if(x >= l && x <= r){ for(auto pp:v[x]) pq.push({1,pp}); } } } if(vis[e][1])ans.push_back(1); else ans.push_back(0); } 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:13:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<X.size();i++){
                 ~^~~~~~~~~
werewolf.cpp:18:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     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...