-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblack.cpp
62 lines (60 loc) · 813 Bytes
/
black.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,x,y,i=0,flag1=1,flag2=0;
scanf("%d",&n);
string s1,s2;
cin>>s1;
cin>>s2;
for (i = 0; i < n; ++i)
{
if(s1[i]=='#'){
x=i;
if(s2[i]=='#'){
y=i;
}
break;
}
if(s2[i]=='#'){
y=i;
break;
}
flag1=1;
}
//cout<<x<<i<<endl;
for(;i<n;i++){
if(s2[i]=='#'){
if(abs(y-i)==0){
//y=i;
flag1=1;
//cout<<"1";
}
else if(y!=i){
// cout<<"2";
flag1=0;
}
}
if(s1[i]=='#'){
//cout<<x-i;
if(abs(x-i)==1){//for adjacency check
flag1=1;
//x=i;
//cout<<"3";
}
else if(x!=i){
flag1=0;
//cout<<"4";
}
}
}
if(flag1){
cout<<"yes"<<endl;
}
else{
cout<<"no"<<endl;
}
}
}