AT_scpc2026_div1_c.SCSC Magical Garden

入门

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

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

题目描述

Haru_101 prepared an N×NN \times N grid-shaped garden for SCSC. Every spring, SCSC members have a beautiful tradition of planting one flower in each cell. This year, they decided to plant sunflowers and clovers.

After all flowers were planted, Terra and Lulu looked around the garden and gave different impressions.

Terra looked down at the whole garden from a high place and said: "Looking at the whole garden, there are more cells planted with blue clovers than yellow sunflowers!"

Lulu likes taking photos, so Lulu walked around the garden and took photos of size 3×33 \times 3. After taking photos of every 3×33 \times 3 area in the garden without omission, Lulu looked at the photos and said: "Huh? In every photo I took, there are more sunflowers than clovers!"

Can you make a magical garden where, as Terra said, the whole garden has more clovers, but every photo Lulu took has more sunflowers?

Haru_101 为 SCSC 准备了一个 N×NN \times N 的网格状花园。每年春天,SCSC 成员都有一个优美的传统:在每个格子中种植一朵花。今年,他们决定种植向日葵和三叶草。

所有花朵种完后,Terra 和 Lulu 在花园中四处观察,并给出了不同的印象。

Terra 从高处俯瞰整个花园,说道:“从整体上看,种有蓝色三叶草的格子数比种有黄色向日葵的格子数更多!”

Lulu 喜欢拍照,因此她绕着花园走了一圈,拍摄了所有大小为 3×33 \times 3 的区域的照片(不遗漏任何一处)。拍完所有 3×33 \times 3 区域的照片后,Lulu 查看照片并说道:“咦?我拍的每一张照片中,向日葵的数量都比三叶草多!”

你能否构造一个“神奇的花园”,使得:正如 Terra 所说,整个花园中三叶草总数多于向日葵;但同时,Lulu 拍摄的每一张 3×33 \times 3 照片中,向日葵数量都多于三叶草?

输入格式

The input is given from Standard Input in the following format:

TT
case1\mathrm{case}_1
case2\mathrm{case}_2
⋮\vdots
caseT\mathrm{case}_T

Each test case is given in the following format:

NN

输入从标准输入给出,格式如下:

TT
case1\mathrm{case}_1
case2\mathrm{case}_2
⋮\vdots
caseT\mathrm{case}_T

每个测试用例的格式如下:

NN

输出格式

For each test case, output the answer in the following format.

If it is possible to make a magical garden, output YES on the first line.

Then output NN lines, each containing a string of length NN representing the state of the garden. Each string must consist only of S and C. The jj-th character of the ii-th string must be S if the flower planted in cell (i,j)(i,j) of the garden is a sunflower, and C if it is a clover. In every 3×33 \times 3 subgrid of the grid, the number of S must be greater than the number of C, and in the whole grid, the number of C must be greater than the number of S.

If there are multiple magical gardens, output any one of them.

If it is impossible to make a magical garden, output NO on a single line instead.

对于每个测试用例,按以下格式输出答案:

如果能够构造出一个魔法花园,则在第一行输出 YES。

随后输出 NN 行,每行是一个长度为 NN 的字符串,表示花园的状态。每个字符串仅由字符 S 和 C 组成。第 ii 行的第 jj 个字符应为 S,当且仅当花园中位置 (i,j)(i,j) 处种植的是向日葵;应为 C,当且仅当该位置种植的是三叶草。在网格的每一个 3×33 \times 3 子网格中,S 的数量必须严格大于 C 的数量;而在整个 N×NN \times N 网格中,C 的数量必须严格大于 S 的数量。

若存在多个满足条件的魔法花园,输出任意一个即可。

若无法构造出魔法花园,则单独一行输出 NO。

输入输出样例

  • 输入#1

    1
    3

    输出#1

    NO
  • 输入#2

    1
    4

    输出#2

    YES
    CCSC
    CSSC
    CSSC
    CCSC

说明/提示

表示言語

/ /

Constraints

  • 1≤T≤1 0001 \leq T \leq 1\,000
  • For each test case, 3≤N≤1 0003 \leq N \leq 1\,000.
  • All given numbers are integers.
  • Only cases where the output does not exceed 22 MiB are given.

表示语言

/ /

限制条件

  • 1≤T≤1 0001 \leq T \leq 1\,000
  • 对于每个测试用例,3≤N≤1 0003 \leq N \leq 1\,000。
  • 所有给定的数均为整数。
  • 输入数据仅包含输出大小不超过 22 MiB 的情况。

输入解题思路,AI测评打分。不知道怎么写?

首页