이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "werewolf.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long
#define inf 1000000009
#define md 1000000007
#define li 200005
#define mp make_pair
#define pb push_back
#define mid (start+end)/2
using namespace std;
int vis[li][2];
queue< pair<int,int> > q;
vector<int> v[li],ans,genel;
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(int i=0;i<(int)S.size();i++){
for(int j=0;j<N;j++) v[j].clear();
memset(vis,0,sizeof(vis));
for(int j=0;j<(int)X.size();j++){
v[X[j]].pb(Y[j]);
v[Y[j]].pb(X[j]);
}
if(S[i]<L[i]) {ans.pb(0);continue;}
if(S[i]>=L[i] && S[i]<=R[i]) q.push(mp(S[i],1));
q.push(mp(S[i],0));
int flag=0;
while(!q.empty()){
pair<int,int> temp=q.front();
q.pop();
int seh=temp.fi;
int tur=temp.se;
if(tur==0 && seh<L[i]) continue;
if(tur==1 && seh>R[i]) continue;
if(vis[seh][tur]==1) continue;
if(seh==E[i] && tur==1){
flag=1;
break;
}
vis[seh][tur]=1;
for(int j=0;j<(int)v[seh].size();j++){
int go=v[seh][j];
if(go>=L[i] && go<=R[i]) q.push(mp(go,1));
q.push(mp(go,tur));
}
}
if(flag==1) ans.pb(1);
else ans.pb(0);
}
return ans;
}
//~ int main(){
//~ genel=check_validity(6,x1,yy1,s1,e1,l1,r1);
//~ return 0;
//~ }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |