CF398A.Cards

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

User ainta loves to play with cards. He has aa cards containing letter "o" and bb cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below.

  1. At first, the score is 00 .
  2. For each block of contiguous "o"s with length xx the score increases by x2x^{2} .
  3. For each block of contiguous "x"s with length yy the score decreases by y2y^{2} .

For example, if a=6,b=3a=6,b=3 and ainta have arranged the cards in the order, that is described by string "ooxoooxxo", the score of the deck equals 2212+3222+12=92^{2}-1^{2}+3^{2}-2^{2}+1^{2}=9 . That is because the deck has 5 blocks in total: "oo", "x", "ooo", "xx", "o".

User ainta likes big numbers, so he wants to maximize the score with the given cards. Help ainta make the score as big as possible. Note, that he has to arrange all his cards.

输入格式

The first line contains two space-separated integers aa and bb ( 0<=a,b<=105; a+b>=10<=a,b<=10^{5}; a+b>=1 ) — the number of "o" cards and the number of "x" cards.

输出格式

In the first line print a single integer vv — the maximum score that ainta can obtain.

In the second line print a+ba+b characters describing the deck. If the kk -th card of the deck contains "o", the kk -th character must be "o". If the kk -th card of the deck contains "x", the kk -th character must be "x". The number of "o" characters must be equal to aa , and the number of "x " characters must be equal to bb . If there are many ways to maximize vv , print any.

Please, do not write the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

输入输出样例

  • 输入#1

    2 3
    

    输出#1

    -1
    xoxox
    
  • 输入#2

    4 0
    

    输出#2

    16
    oooo
  • 输入#3

    0 4
    

    输出#3

    -16
    xxxx
首页