Submission #770311

#TimeUsernameProblemLanguageResultExecution timeMemory
770311boyliguanhanWerewolf (IOI18_werewolf)C++17
15 / 100
191 ms19548 KiB
#include "werewolf.h" #include<bits/stdc++.h> using namespace std; vector<int>adj[3010], ans; bitset<6010>vis; int dfs(int n, int target, int l, int r, int form=0){ if(vis[3000*form+n]) return 0; vis[3000*form+n] = 1; if(form&&n>r||!form&&n<l) return 0; if(!form&&dfs(n,target,l,r,1))return 1; if(n==target) return 1; for(auto i: adj[n]) if(dfs(i,target,l,r,form)) return 1; return 0; } vector<int>check_validity(int N,vector<int>X,vector<int>Y,vector<int>s,vector<int>e,vector<int>l,vector<int>r){ vector<int> ans; for(int i=0;i<X.size();i++) adj[X[i]].push_back(Y[i]),adj[Y[i]].push_back(X[i]); for(int i=0;i<s.size();i++){ vis.reset(); ans.push_back(dfs(s[i],e[i],l[i],r[i])); } return ans; }

Compilation message (stderr)

werewolf.cpp: In function 'int dfs(int, int, int, int, int)':
werewolf.cpp:9:12: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
    9 |     if(form&&n>r||!form&&n<l) return 0;
      |        ~~~~^~~~~
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:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=0;i<X.size();i++)
      |                 ~^~~~~~~~~
werewolf.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     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...