P23645 [AtCoder] ox Concatenation
提高+
题目描述

Problem Description

Rasukun is trying to create a string $ S $ of length $ N $ consisting of o and x.

To do this, Rasukun has bought $ A $ strings of ox, $ B $ strings of xo, $ C $ characters of o, and $ D $ characters of x.

Here, it holds that $ 2A+2B+C+D=N $.

Determine if it is possible to create the string $ S $ by concatenating these in any order. Note that you are not allowed to split or reverse the strings ox or xo.

Input Format

The input is given from the standard input in the following format:

$ N $ $ S $ $ A $ $ B $ $ C $ $ D $

Output Format

Output Yes if the string $ S $ can be created, otherwise output No.

Sample Input and Output

Sample Input #1

6
oxoxox
1 1 1 1

Sample Output #1

Yes

Sample Input #2

6
oxoxox
2 1 0 0

Sample Output #2

No

Sample Input #3

7
xxxxxxx
1 1 1 2

Sample Output #3

No

Sample Input #4

9
xoxoxxoxo
2 2 0 1

Sample Output #4

Yes

Notes/Hints

Constraints

  • $1 \leq N \leq 2 \times 10^5$
  • $0 \leq A, B, C, D \leq N$
  • $ 2A + 2B + C + D = N $
  • $ N, A, B, C, D $ are integers.
  • $ S $ is a string of length $ N $.
  • Each character in $ S $ is either o or x.

Partial Points

This problem has partial points.

  • Correctly solving the input where $N \leq 4000$ will award $ 300 $ points.

Sample Explanation 1

Concatenate in the order of ox, o, xo, x.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 oxoxox 1 1 1 1
样例输出
Yes