Submission #1026156

#TimeUsernameProblemLanguageResultExecution timeMemory
1026156marizaWerewolf (IOI18_werewolf)C++14
15 / 100
4032 ms38552 KiB
#include <bits/stdc++.h> #include "werewolf.h" using namespace std; typedef long long ll; vector<ll> g[200000]; ll s, e, l, r; bool vis[200000][2]; void dfs(ll curr, bool w){ if(vis[curr][w]) return; vis[curr][w]=true; bool ans=false; if(l<=curr && curr<=r && !w) dfs(curr,true); for(auto nxt:g[curr]){ if(!w && l<=nxt) dfs(nxt,false); else if(w && nxt<=r) dfs(nxt,true); } } vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) { for(ll i=0; i<X.size(); i++){ g[X[i]].push_back(Y[i]); g[Y[i]].push_back(X[i]); } ll Q = S.size(); vector<int> a; for(ll i=0; i<Q; i++){ s=S[i]; e=E[i]; l=L[i]; r=R[i]; for(ll j=0; j<N; j++){ vis[j][0]=false; vis[j][1]=false; } dfs(s,false); a.push_back(vis[e][1]); } return a; }

Compilation message (stderr)

werewolf.cpp: In function 'void dfs(ll, bool)':
werewolf.cpp:15:10: warning: unused variable 'ans' [-Wunused-variable]
   15 |     bool ans=false;
      |          ^~~
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:25:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(ll i=0; i<X.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...