#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=b;i>=a;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
// typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// template< typename T>
// using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,m,ans,mid,mn,mx,T,sum,h1,h2,e[1234567],b[1234567],c[1234567],d[1<<20],k,i,j,l,r,h,a[1234567],w,x,y,z,res,cnt,sz;
bool used[1234567];
vector<ll> v[1234567],vec,vv1,vv2;
string s1,s;
ll dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};
vl check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R){
m = X.size();
n=N;
vector<int> ans(n);
rep(i,0,m-1){
v[X[i]].pb(Y[i]);
v[Y[i]].pb(X[i]);
}
ll q = S.size();
rep(i,0,q){
int used1[n+1]={0},used2[n+1]={0};
vector<int> vec;
vec.pb(S[i]);
while(!vec.empty()){
int tmp = vec.back();
vec.po();
if(tmp<L[i]||used1[tmp]){
con;
}
used1[tmp]=1;
rep(i,0,v[tmp].size()-1){
vec.pb(v[tmp][i]);
}
}
vec.pb(E[i]);
while(!vec.empty()){
int tmp = vec.back();
vec.po();
if(tmp>R[i]||used2[tmp]){
con;
}
used2[tmp]=1;
rep(i,0,v[tmp].size()-1){
vec.pb(v[tmp][i]);
}
}
rep(i,0,n-1){
if(used1[i]*used2[i]){
ans[i]=1;
}
}
}
return ans;
}
Compilation message
werewolf.cpp: In function 'vl check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:17:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define rep(i,a,b) for(ll i=a;i<=b;i++)
werewolf.cpp:50:17:
rep(i,0,v[tmp].size()-1){
~~~~~~~~~~~~~~~~~~~
werewolf.cpp:50:13: note: in expansion of macro 'rep'
rep(i,0,v[tmp].size()-1){
^~~
werewolf.cpp:17:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define rep(i,a,b) for(ll i=a;i<=b;i++)
werewolf.cpp:62:17:
rep(i,0,v[tmp].size()-1){
~~~~~~~~~~~~~~~~~~~
werewolf.cpp:62:13: note: in expansion of macro 'rep'
rep(i,0,v[tmp].size()-1){
^~~
werewolf.cpp:67:24: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
if(used1[i]*used2[i]){
~~~~~~~~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
29312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
29312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4086 ms |
48252 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
29312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |