## The Contest Contest 1 P1 - A Typical Codeforces Problem

View as PDF

Points: 5
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

You just came up with a problem to put on a rated contest! You've invited testers to test the problem, numbered from to , each of whom will attempt the problem and then vote either YES or NO. In order for the problem to be approved, a majority (strictly greater than half) of the testers must vote YES. You already know how each tester will vote, but it may not be a majority.

However, you have a few tricks up your sleeve. In one move, you can select an interval . Let be the number of testers in that interval that vote YES. Then, you can change the vote of tester to YES. Determine if you are able to force a majority of the testers to vote YES after making any number (possibly zero) of moves.

#### Input Specification

The first line of input contains a single integer , the number of testers.

The second line contains a string of length consisting of Y or N characters. The character is Y if the tester votes YES and N if the tester votes NO.

#### Output Specification

Output YES if you're able to force a majority of the testers to vote YES.

Otherwise, output NO.

4
YNNY

YES

#### Explanation for Sample 1

On the first move, we can select the interval to get and force tester to vote YES.

The votes are now YYNY, which is a majority.

5
NYNNN

NO

#### Explanation for Sample 2

There are no sequences of moves that result in a majority of the testers voting YES.

3
YYN

YES

#### Explanation for Sample 3

A majority of the testers already vote YES, so no moves are necessary.

## Comments

• commented on July 28, 2024, 2:03 a.m. edited

keeps saying my output is clipped what does that mean??