Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll>Vl;
typedef pair<ll,ll>PII;
typedef vector<PII>Vll;
typedef vector<pair<ll,pair<ll,ll> > >Vlll;
typedef priority_queue<ll>PQL;
typedef map<ll,ll>MP;
#define S second;
#define F first;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end));i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define MAX 200005
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define rf(i,a,b) for(int i=(a);i>=b;i--)
#define sl(n) scanf("%lld",&n)
#define pl(n) printf("%lld",n)
const ll mod=1000000009;

Vl graph[MAX];
bool visited[MAX];

void dfs(ll src){
    visited[src]=true;
    for(auto it:graph[src]){
        if(!visited[it])
        dfs(it);
    }
}

int main(){
    ll N,A,B,C,D;
    string str;
    sl(N);sl(A);sl(B);sl(C);sl(D);
    cin>>str;#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll>Vl;
typedef pair<ll,ll>PII;
typedef vector<PII>Vll;
typedef vector<pair<ll,pair<ll,ll> > >Vlll;
typedef priority_queue<ll>PQL;
typedef map<ll,ll>MP;
#define S second;
#define F first;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end));i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define MAX 200005
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define rf(i,a,b) for(int i=(a);i>=b;i--)
#define sl(n) scanf("%lld",&n)
#define pl(n) printf("%lld",n)
const ll mod=1000000009;

Vl graph[MAX];
bool visited[MAX];

void dfs(ll src){
    visited[src]=true;
    for(auto it:graph[src]){
        if(!visited[it])
        dfs(it);
    }
}

int main(){
    ll N,A,B,C,D;
    string str;
    sl(N);sl(A);sl(B);sl(C);sl(D);
    cin>>str;
    ll i=0;
    for(ll i=1;i<=N;i++){
        if(i+1<=N && str[i-1]=='.'){
            if(str[i]=='.')graph[i].pb(i+1);
        }
         if(i+2<=N && str[i-1]=='.'){
            if(str[i+1]=='.')graph[i].pb(i+2);
        }

    }
    if(C==D || str[C-1]=='#' || str[D-1]=='#')
    {
        cout<<"No";
        return 0;
    }

    if((A<B && C<D)||(A>B && C>D)){

        ms(visited,false);
        dfs(A);
        bool check1=false,check2=false;
        dfs(A);
        if(visited[C])check1=true;
        ms(visited,false);
        dfs(B);
        if(visited[D])check2=true;
        if(check1 && check2){
            cout<<"Yes"<<endl;
            return 0;
        }

    }
    for(ll i=max(A,B);i<=N;i++){
        if(graph[i].size()>1 && i!=C && i!=D && i!=min(A,B)){
            ll ci=0,di=0,cd;
            for(auto it:graph[i]){
                ms(visited,false);
                dfs(it);
                if(visited[C] && !visited[D])ci++;
                else if(visited[D] && !visited[C])di++;
                else if(visited[C] && visited[D])cd++;
            }
            if((ci>=1 && di>=1)||(cd>=2)){
            cout<<"Yes";
            return 0;
            }
        }

    }
    cout<<"No"<<endl;
return 0;
}

    ll i=0;
    for(ll i=1;i<=N;i++){
        if(i+1<=N && str[i-1]=='.'){
            if(str[i]=='.')graph[i].pb(i+1);
        }
         if(i+2<=N && str[i-1]=='.'){
            if(str[i+1]=='.')graph[i].pb(i+2);
        }

    }
    for(ll i=1;i<=N;i++){
        if(graph[i].size()>1 && i!=C && i!=D && i!=min(A,B)){
            ll ci=0,di=0,cd;
            for(auto it:graph[i]){
                ms(visited,false);
                dfs(it);
                if(visited[C] && !visited[D])ci++;
                else if(visited[D] && !visited[C])di++;
                else if(visited[C] && visited[D])cd++;
            }
            if((ci>=1 && di>=1)||(cd>=2)){
            cout<<"Yes";
            return 0;
            }
        }

    }
    cout<<"No"<<endl;
return 0;
}


Compiler output:
a.cc:38:14: error: stray '#' in program
   38 |     cin>>str;#include<bits/stdc++.h>
      |              ^
a.cc: In function 'int main()':
a.cc:38:15: error: 'include' was not declared in this scope
   38 |     cin>>str;#include<bits/stdc++.h>
      |               ^~~~~~~
a.cc:38:23: error: 'bits' was not declared in this scope
   38 |     cin>>str;#include<bits/stdc++.h>
      |                       ^~~~
a.cc:38:28: error: 'stdc' was not declared in this scope; did you mean 'std'?
   38 |     cin>>str;#include<bits/stdc++.h>
      |                            ^~~~
      |                            std
a.cc:39:1: error: expected primary-expression before 'using'
   39 | using namespace std;
      | ^~~~~
a.cc:63:17: error: a function-definition is not allowed here before '{' token
   63 | void dfs(ll src){
      |                 ^
a.cc:71:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   71 | int main(){
      |         ^~
a.cc:71:9: note: remove parentheses to default-initialize a variable
   71 | int main(){
      |         ^~
      |         --
a.cc:71:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:71:11: error: a function-definition is not allowed here before '{' token
   71 | int main(){
      |           ^