#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LSOne(s) ((s)&(-s))
ll INF=1e18+10;
int inf=1e9+10;
ll M=1e9+7;
std::vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y,
std::vector<int> S, std::vector<int> E,
std::vector<int> L, std::vector<int> R) {
int Q = S.size();
int m=X.size();
vii a;
a.resize(N);
REP(i,0,m){
a[X[i]].PB(Y[i]);
a[Y[i]].PB(X[i]);
}
vi ans(Q,0);
REP(i,0,Q){
queue<int> pq;
vi c(N,0),d(N,0);
pq.push(S[i]);
while(!pq.empty()){
int k=pq.front();
pq.pop();
if(c[k]||k<L[i])continue;
c[k]=1;
for(auto u:a[k])pq.push(u);
}
pq.push(E[i]);
while(!pq.empty()){
int k=pq.front();
pq.pop();
if(d[k]||k>R[i])continue;
d[k]=1;
for(auto u:a[k])pq.push(u);
}
REP(j,L[i],R[i]+1){
ans[i]|=(c[j]&d[j]);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
440 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
440 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
197 ms |
856 KB |
Output is correct |
11 |
Correct |
108 ms |
876 KB |
Output is correct |
12 |
Correct |
9 ms |
880 KB |
Output is correct |
13 |
Correct |
213 ms |
860 KB |
Output is correct |
14 |
Correct |
129 ms |
860 KB |
Output is correct |
15 |
Correct |
163 ms |
984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4029 ms |
31980 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
440 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
197 ms |
856 KB |
Output is correct |
11 |
Correct |
108 ms |
876 KB |
Output is correct |
12 |
Correct |
9 ms |
880 KB |
Output is correct |
13 |
Correct |
213 ms |
860 KB |
Output is correct |
14 |
Correct |
129 ms |
860 KB |
Output is correct |
15 |
Correct |
163 ms |
984 KB |
Output is correct |
16 |
Execution timed out |
4029 ms |
31980 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |