3 a -5 ab 10 ba -20
Infinity For example, if $S =$ `abzabz`: * The score determined by the $1$\-st criterion is $2 \times (-5) = -10$ points, because `a` occurs twice in $S$ as a consecutive subsequence. * The score determined by the $2$\-nd criterion is $2 \times 10 = 20$ points, because `ab` occurs twice in $S$ as a consecutive subsequence. * The score determined by the $3$\-rd criterion is $0 \times (-20) = 0$ points, because `ba` occurs $0$ times in $S$ as a consecutive subsequence. Thus, the beauty of $S$ is $(-10) + 20 + 0 = 10$. As another example, if $S =$ `abzabzabz`: * The score determined by the $1$\-st criterion is $3 \times (-5) = -15$ points, because `a` occurs $3$ times in $S$ as a consecutive subsequence. * The score determined by the $2$\-nd criterion is $3 \times 10 = 30$ points, because `ab` occurs $3$ times in $S$ as a consecutive subsequence. * The score determined by the $3$\-rd criterion is $0 \times (-20) = 0$ points, because `ba` occurs $0$ times in $S$ as a consecutive subsequence. Thus, the beauty of $S$ is $(-15) + 30 + 0 = 15$. In general, for a positive integer $X$, if $S$ is a concatenation of $X$ copies of `abz`, then the beauty of $S$ is $5X$. Since you can obtain as large beauty as you want, `Infinity` should be printed.
28 a -5 ab 10 ba -20 bb -20 bc -20 bd -20 be -20 bf -20 bg -20 bh -20 bi -20 bj -20 bk -20 bl -20 bm -20 bn -20 bo -20 bp -20 bq -20 br -20 bs -20 bt -20 bu -20 bv -20 bw -20 bx -20 by -20 bz -20
5 $S = $ `ab` achieves the maximum beauty possible.
26 a -1 b -1 c -1 d -1 e -1 f -1 g -1 h -1 i -1 j -1 k -1 l -1 m -1 n -1 o -1 p -1 q -1 r -1 s -1 t -1 u -1 v -1 w -1 x -1 y -1 z -1
\-1 Note that $S$ should be a non-empty string.
{
"problem": {
"name": "String Fair",
"description": {
"content": "In a string fair, they determine the _beauty_ of a non-empty string $S$ consisting of lowercase English letters. The beauty of string $S$ equals the sum of $N$ scores determined by $N$ criteria. For $",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc264_g"
},
"statements": [
{
"statement_type": "Markdown",
"content": "In a string fair, they determine the _beauty_ of a non-empty string $S$ consisting of lowercase English letters.\nThe beauty of string $S$ equals the sum of $N$ scores determined by $N$ criteria. For $...",
"is_translate": false,
"language": "English"
}
]
}