#include "werewolf.h"
#include <bits/stdc++.h>
#define pb push_back
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)
using namespace std;
vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) {
int Q=S.size(), M=X.size();
if(N>3000 || M>6000 || Q>3000){
return {};
}
vector<int> adj[N], A;
rep(i,0,M){
adj[X[i]].pb(Y[i]);
adj[Y[i]].pb(X[i]);
}
queue<int> q;
rep(i,0,Q){
bool vis[N][2]{};
q.push(S[i]);
q.push(0);
vis[S[i]][0]=true;
while(q.size()){
int u=q.front();
q.pop();
int z=q.front();
q.pop();
repa(v,adj[u]){
if(!z && v>=L[i] && !vis[v][z]){
vis[v][z]=true;
q.push(v);
q.push(z);
}
if(z && v<=R[i] && !vis[v][z]){
vis[v][z]=true;
q.push(v);
q.push(z);
}
if(!z && L[i]<=v && R[i]>=v){
vis[v][1]=true;
q.push(v);
q.push(1);
}
}
}
A.pb(vis[E[i]][1]);
}
return A;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
86 ms |
9760 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |