제출 #434470

#제출 시각아이디문제언어결과실행 시간메모리
434470ismoilov늑대인간 (IOI18_werewolf)C++14
0 / 100
180 ms19660 KiB
#include "werewolf.h" #include <bits/stdc++.h> using namespace std; #define vi vector <int> bool vis[3003]; vector <int> g[3003]; void check(int u, int p, bool state, int l, int r, int e){ if(u == e){ if(state==0 || r >= p || (u <= r && u >= l)){ vis[u] = 1; } return; } if(vis[u] && e != u) return; if(state){ if(u < l) if(r >= p && u <= r) state = 0; else return; } else{ if(u > r) return; } vis[u] = 1; for(auto v : g[u]){ if(v == p) continue; // cout << v << " " << u << " " << state << "\n"; check(v, u, state, l, r, e); } } vi check_validity(int n, vi x, vi y, vi s, vi e, vi L, vi R) { int m = x.size(); for(int i = 0; i < m; i ++){ g[x[i]].push_back(y[i]); g[y[i]].push_back(x[i]); } int q = s.size(); vector <int> ans; for(int i = 0; i < q; i ++){ memset(vis, 0, sizeof(vis)); check(s[i], s[i], 1, L[i], R[i], e[i]); ans.push_back(vis[e[i]]); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

werewolf.cpp: In function 'void check(int, int, bool, int, int, int)':
werewolf.cpp:18:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   18 |         if(u < l)
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...