## DMOPC '22 Contest 2 P1 - DMOPC Crisis

View as PDF

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

A long time ago, in a certain Dmojistan far far away, there existed a small DMOPC committee of people. One fateful day, when the members were sitting in a circle (with the -th member sitting next to the -th for all and the -th member sitting next to the first) discussing new problem ideas, an evil witch appeared and stated the following: "Look to your left and to your right. By the beginning of next year, at least one of those people will be gone". Terrified about the legitimacy of her statement, the DMOPC committee banded together and wondered: if what the witch said was true, at most how many members will remain in the committee next year? Your job is to answer this question and provide an example of an optimal scenario.

#### Input Specification

The first and only line contains a single integer .

#### Output Specification

On the first line output an integer , representing the maximum number of people that can remain in the committee next year.

On the second line output a string of length consisting of the characters _ and M. This string should represent an optimal scenario in which the members used to sit in a circle and people remain in the committee. Specifically, the -th character of the string should be M if the -th member stays, or _ if they leave. Each index should have at least one character _ next to it, and there should be exactly character Ms in the string. If there exist multiple optimal scenarios, output any one of them.

#### Scoring

For each test case:

If the integer you output is not maximal, your score will be and you will receive a Wrong Answer verdict.

If the integer you output is maximal but your configuration is invalid or missing, you will receive points.

Your score for a subtask will be the minimum score over all test cases in the subtask multiplied by the weight of the subtask.

Your final score will be the sum of the scores of all the subtasks.

#### Sample Input

4

#### Sample Output

2
_MM_

• commented on Dec. 16, 2022, 8:48 p.m. edited

if you were to input 6, shouldn't the answer be:

4
M_MM_M

But according to the editorial, it says it should be 2?

• commented on Dec. 17, 2022, 11:09 a.m. edit 3

This comment is hidden due to too much negative feedback. Show it anyway.

• commented on Dec. 17, 2022, 3:12 p.m. edit 3

This comment is hidden due to too much negative feedback. Show it anyway.

• commented on Dec. 17, 2022, 5:47 p.m.

This comment is hidden due to too much negative feedback. Show it anyway.

• commented on Dec. 16, 2022, 9:34 p.m.

methinks its fixd now