题面炸了
查看原帖
题面炸了
526677
封禁用户楼主2023/8/2 10:40

rt, @小粉兔

题目描述

The row-major order of an r×cr \times c grid of characters AA is the string obtained by concatenating all the rows, i.e.

A11A12…A1cA21A22…A2c…Ar1Ar2…Arc. A_{11}A_{12} \dots A_{1c}A_{21}A_{22} \dots A_{2c} \dots A_{r1}A_{r2} \dots A_{rc}.

A grid of characters AA is bad if there are some two adjacent cells (cells sharing an edge) with the same character.

You are given a positive integer nn . Consider all strings ss consisting of only lowercase Latin letters such that they are not the row-major order of any bad grid. Find any string with the minimum number of distinct characters among all such strings of length nn.

It can be proven that at least one such string exists under the constraints of the problem.

2023/8/2 10:40
加载中...