Submission #139162

#TimeUsernameProblemLanguageResultExecution timeMemory
139162rajarshi_basuWerewolf (IOI18_werewolf)C++14
15 / 100
354 ms19576 KiB
#include <bits/stdc++.h> #include "werewolf.h" #define FOR(i,n) for(int i=0;i<n;i++) #define FORE(i,a,b) for(int i = a;i<=b;i++) #define ll long long int #define pb push_back #define vi vector<int> #define ff first #define ss second #define vv vector #define ii pair<int,int> using namespace std; const int MAXN = 3001; vi g[MAXN]; bool reachableHuman[MAXN]; bool reachableWolf[MAXN]; bool vis[MAXN]; void dfs(int node,int mode,int x){ if(vis[node])return; vis[node] = 1; if(mode == 1)reachableHuman[node] = 1; if(mode == 2)reachableWolf[node] = 1; for(auto e : g[node]){ if(mode == 1 and e >= x)dfs(e,mode,x); if(mode == 2 and e <= x)dfs(e,mode,x); } } bool solve(int n,int l,int r,int s,int e){ FOR(i,n)reachableHuman[i] = reachableWolf[i] = vis[i] = 0; dfs(s,1,l); FOR(i,n)vis[i] = 0; dfs(e,2,r); FOR(i,n)if(reachableHuman[i] and reachableWolf[i])return true; return false; } vi check_validity(int n,vi x,vi y,vi s,vi e,vi l,vi r){ FOR(i,x.size()){ g[x[i]].pb(y[i]); g[y[i]].pb(x[i]); } int q = s.size(); vi ret;FOR(i,q)ret.pb(0); FOR(i,q){ ret[i] = solve(n,l[i],r[i],s[i],e[i]); } return ret; } int ma1in(){ ios_base::sync_with_stdio(0); cin.tie(0); return 0; }

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:5:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define FOR(i,n) for(int i=0;i<n;i++)
werewolf.cpp:46:6:
  FOR(i,x.size()){
      ~~~~~~~~~~                
werewolf.cpp:46:2: note: in expansion of macro 'FOR'
  FOR(i,x.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...