Problem:
Score : 400 points

Problem Statement

There are N squares arranged in a row, numbered 1, 2, ..., N from left to right.
You are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.

In the beginning, Snuke stands on Square A, and Fnuke stands on Square B.

You can repeat the following operation any number of times:

Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.

You want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.

Determine whether this is possible.

Constraints

4 \leq N \leq 200\ 000

S is a string of length N consisting of . and #.

1 \leq A, B, C, D \leq N

Square A, B, C and D do not contain a rock.

A, B, C and D are all different.

A < B

A < C

B < D

Input

Input is given from Standard Input in the following format:

N A B C D
S

Output

Print Yes if the objective is achievable, and No if it is not.

Sample Input 1

7 1 3 6 7
.#..#..

Sample Output 1

Yes

The objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)

A#B.#..

A#.B#..

.#AB#..

.#A.#B.

.#.A#B.

.#.A#.B

.#..#AB

Sample Input 2

7 1 3 7 6
.#..#..

Sample Output 2

No

Sample Input 3

15 1 3 15 13
...#.#...#.#...

Sample Output 3

Yes

Solution in Go (1.6) (judge verdict: Wrong Answer)

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)

	return i
}

func max(v int, values ...int) int {
	l := len(values)
	m := v

	for i := 0; i < l; i++ {
		if m < values[i] {
			m = values[i]
		}
	}

	return m
}

func min(v int, values ...int) int {
	l := len(values)
	m := v

	for i := 0; i < l; i++ {
		if m > values[i] {
			m = values[i]
		}
	}

	return m
}

var s []byte
var n int

func canMove(from, to int) bool {
	path := make([]int, n)
	path[from] = 1

	for i := from + 1; i <= to; i++ {
		if s[i] == '#' { // 岩ならNG
			path[i] = 0
		} else if path[i-1] == 1 { // 一つ前が通れるならOK
			path[i] = 1
		} else if i >= 2 && path[i-2] == 1 { // 2つ前が通れるならOK
			path[i] = 1
		}
	}

	return path[to] == 1
}

func main() {
	n = nextInt()
	a := nextInt() - 1
	b := nextInt() - 1
	c := nextInt() - 1
	d := nextInt() - 1
	s = nextBytes()

	if !canMove(a, c) {
		fmt.Println("No")
		return
	}
	if !canMove(b, d) {
		fmt.Println("No")
		return
	}

	if c < b || c < d { // AがBを飛び越さないケースはこのまま
		fmt.Println("Yes")
		return
	}

	// AがCに行くまでの途中に3マス連続のマスが必要
	lower := b - 1
	upper := min(c-2, n-2)
	for i := lower; i < upper; i++ {
		if s[i] == '.' && s[i+1] == '.' && s[i+2] == '.' {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}