P26904 [AtCoder] Doubling
提高
题目描述

Problem Description

There are $ N $ squares arranged in a single row from left to right. The $ i $ -th square from the left is called square $ i $.
Some of the squares contain ninjas, and this arrangement is given as a string $ S $. The $ i $ -th character of $ S $ is # if there is a ninja on square $ i $, and . if there is no ninja on square $ i $.
You can perform two types of operations, type A and type B, in any order and any number of times, including not performing any operations at all.

  • Type A: All ninjas currently on squares other than square $ 1 $ create a clone on the square immediately to their left. Clones are treated the same as the original ninjas.
  • Type B: All ninjas currently on squares other than square $ N $ create a clone on the square immediately to their right. Clones are treated the same as the original ninjas.

Let $ x $ be the number of times type A is performed, and $ y $ be the number of times type B is performed.
Find one pair of $ x $ and $ y $ such that after all operations, every square has at least one ninja, and $ x + y $ is minimized.

Input Format

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

$ N $ $ S $

Output Format

Output one pair of $ x $ and $ y $ in the procedure where $ x + y $ is minimized, separated by a space.

Sample Input and Output

Sample Input #1

5
.#..#

Sample Output #1

1 1

Sample Input #2

6
..#...

Sample Output #2

2 3

Sample Input #3

3
###

Sample Output #3

0 0

Notes/Hints

Note

Discussion of this problem is prohibited until 2020/11/8 18:00 JST. If mentioned, it may result in a claim for damages. It is okay to announce the total score and certification level after the exam, but please do not disseminate information about which problems were solved.

Constraints

  • $1 \le N \le 50$
  • $ N $ is an integer
  • $ S $ consists of . and #.
  • $ S $ contains at least one #.

Sample Explanation 1

For example, if type A and type B are performed in that order, the presence of ninjas in each square changes as follows: .#..# -> ##.## -> #####, and eventually, all squares have ninjas. Since it is not possible to achieve the goal with a total number of operations less than $ 2 $, this is one of the answers. For example, 2 0 is also a correct answer.

Sample Explanation 2

This is the only correct answer.

Sample Explanation 3

Sometimes, no doubling is necessary at all.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 .#..#
样例输出
1 1