Submission #741099

#TimeUsernameProblemLanguageResultExecution timeMemory
741099almothana05Werewolf (IOI18_werewolf)C++14
0 / 100
4067 ms26972 KiB
#include "werewolf.h" #include<bits/stdc++.h> using namespace std; int vis[2][300000]; vector<int>kinder[300000] , erg; priority_queue<pair<int ,int> >q; int bfs(int x , int en , int l , int r){ if(x >= l){ q.push({0 , x}); } if(x <= r){ q.push({-1 , x}); } while(q.size()){ int jet = q.top().second , cmp = q.top().first; q.pop(); for(int i = 0 ; i < kinder[jet].size() ; i++){ int kind = kinder[jet][i]; if(cmp == -1){ if(kind <= r && vis[1][kind] == 0){ vis[1][kind] = 1; q.push({-1 , kind}); } } else{ if(kind <= r && vis[1][kind] == 0 && (kind >= l || jet <= r)){ vis[1][kind] = 1; q.push({-1 , kind}); } if(kind >= l && vis[0][kind] == 0){ vis[0][kind] = 1; q.push({0 , kind}); } } } } return vis[1][en] == 1; } vector<int> check_validity(int menge, vector<int> x, vector<int> y, vector<int> s, vector<int> e, vector<int> l, vector<int> r) { if(x.size() == menge - 1){ } for(int i = 0 ; i < menge ; i++){ kinder[x[i]].push_back(y[i]); kinder[y[i]].push_back(x[i]); } for(int i = 0 ; i < s.size() ; i++){ for(int i = 0 ; i < menge ; i++){ vis[0][i] = 0; vis[1][i] = 0; } int x = bfs(s[i] , e[i] , l[i] , r[i]); erg.push_back(x); } return erg; }

Compilation message (stderr)

werewolf.cpp: In function 'int bfs(int, int, int, int)':
werewolf.cpp:17:23: 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 < kinder[jet].size() ; i++){
      |                     ~~^~~~~~~~~~~~~~~~~~~~
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:43:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |   if(x.size() == menge - 1){
      |      ~~~~~~~~~^~~~~~~~~~~~
werewolf.cpp:50:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |   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...