Submission #1045486

#TimeUsernameProblemLanguageResultExecution timeMemory
1045486SiliconSquaredWerewolf (IOI18_werewolf)C++17
15 / 100
4014 ms33740 KiB
#include "werewolf.h" using namespace std; #include <vector> struct node{ int x; vector<int> v; bool g,h; node(){} }; vector<node> v; 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) { v.resize(n); for (int i=0;i<X.size();i++){ v[X[i]].v.push_back(Y[i]); v[Y[i]].v.push_back(X[i]); } vector<int> q; vector<int> z; z.resize(S.size()); int p; bool f; for (int _=0;_<S.size();_++){ for (int i=0;i<n;i++){v[i].g=false;v[i].h=false;} q.clear(); q.push_back(S[_]); f=false; while (!q.empty()){ p=q[q.size()-1]; q.pop_back(); if (v[p].g||p<L[_]){continue;} v[p].g=true; for (int i:v[p].v){ q.push_back(i); } } q.clear(); q.push_back(E[_]); while (!q.empty()){ p=q[q.size()-1]; q.pop_back(); if (v[p].h||p>R[_]){continue;} if (v[p].g){f=true;break;} v[p].h=true; for (int i:v[p].v){ q.push_back(i); } } z[_]=f; } return z; }

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:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for (int i=0;i<X.size();i++){
      |                  ~^~~~~~~~~
werewolf.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for (int _=0;_<S.size();_++){
      |                  ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...