제출 #225783

#제출 시각아이디문제언어결과실행 시간메모리
225783DavidDamian늑대인간 (IOI18_werewolf)C++11
0 / 100
4081 ms28024 KiB
#include "werewolf.h" #include<bits/stdc++.h> using namespace std; ///Subtask 1 ///Complete Search vector<int> adjList[3005]; int color[3005]; int l; int r; int s; int t; int completeSearch(int u,int form) { if(u==t){ return 1; } color[u]=1; int answer=0; if(form==0){ for(int v: adjList[u]){ if(answer==1) break; if(color[v]==0){ if(v>=l) answer=completeSearch(v,0); } } if(l<=u && u<=r){ for(int v: adjList[u]){ if(answer==1) break; if(color[v]==0){ if(v<=r) answer=completeSearch(v,1); } } } } else{ for(int v: adjList[u]){ if(answer==1) break; if(color[v]==0){ if(v<=r) answer=completeSearch(v,1); } } } color[u]=0; return answer; } vector<int> check_validity(int n, vector<int> X, vector<int> Y, vector<int> S, vector<int> T, vector<int> L, vector<int> R) { int m=X.size(); for(int i=0;i<m;i++){ int a=X[i]; int b=Y[i]; adjList[a].push_back(b); adjList[b].push_back(a); } int Q=S.size(); vector<int> A; for(int i=0;i<Q;i++){ l=L[i]; r=R[i]; s=S[i]; t=T[i]; A.push_back(completeSearch(S[i],0)); } return A; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...