AT_scpc2026_div3_g.SCSC Game
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This year, FuriosaAI officially announced mass production of RNGD, its second-generation AI accelerator. RNGD is specialized for processing language models and multimodal models, and provides powerful computing performance even with low power consumption.
At SCSC, AI agents Lulu and Terra were created using RNGD chips, and SCSC had them play the SCSC game for performance testing.
The SCSC game is played with a string S consisting of uppercase letters S and C that does not contain SCSC as a substring. Lulu and Terra take turns, with Terra going first. On each turn, the current player chooses one character from the string and removes it. If, after the removal, the string contains SCSC as a substring, that player wins and the other player loses. If the current player can no longer choose any character to remove, that player loses and the other player wins.
Thanks to the powerful computing performance of the RNGD chips, Lulu and Terra have become able to always find optimal moves to win. Given the string S, determine which agent wins the game if both Lulu and Terra play optimally.
What is a substring? A substring of a string is a contiguous part of the original string. For example, `bc` is a substring of `abcd`, but `ac` is not. Multiple substrings may overlap within the same string. For example, `aba` appears a total of 2 times in `ababa`.
今年,FuriosaAI 正式宣布其第二代 AI 加速器 RNGD 进入量产阶段。RNGD 专为处理语言模型与多模态模型而设计,即使在低功耗下也能提供强大的计算性能。
在 SCSC,AI 智能体 Lulu 和 Terra 均基于 RNGD 芯片构建;SCSC 让它们对弈“SCSC 游戏”,以进行性能测试。
SCSC 游戏使用一个仅由大写字母 S 和 C 构成的字符串 S 进行,且该字符串不包含子串 SCSC。Lulu 和 Terra 轮流操作,Terra 先手。每回合中,当前玩家从字符串中选择一个字符并将其移除。若移除后字符串中出现子串 SCSC,则该玩家获胜,另一方失败。若当前玩家已无法移除任何字符(即字符串为空),则该玩家失败,另一方获胜。
得益于 RNGD 芯片的强大算力,Lulu 和 Terra 总能找到最优走法以确保胜利。给定字符串 S,请判断:当双方均采取最优策略时,哪一方智能体会赢得游戏?
什么是子串?一个字符串的子串是指该字符串中一段连续的字符序列。例如,bc 是 abcd 的子串,但 ac 不是。同一字符串中可能存在多个重叠的子串。例如,aba 在 ababa 中总共出现了 2 次。
输入格式
The input is given from Standard Input in the following format:
T
case1
case2
⋮
caseT
Each test case is given in the following format:
S
输入从标准输入中以如下格式给出:
T
case1
case2
⋮
caseT
每个测试用例以如下格式给出:
S
输出格式
For each test case, output Terra if Terra wins, and Lulu if Lulu wins, one per line.
对于每个测试用例,若 Terra 获胜则输出 Terra,若 Lulu 获胜则输出 Lulu,每行一个。
输入输出样例
输入#1
2 SCSSCCS SSSS
输出#1
Terra Lulu
说明/提示
表示言語
/ /
Constraints
- 1≤T≤10000
- 1≤∣S∣≤200000
- S consists only of uppercase letters
SandC, and does not containSCSCas a substring. - The sum of ∣S∣ over all test cases does not exceed 200000.
表示语言
/ /
约束条件
- 1≤T≤10000
- 1≤∣S∣≤200000
- 字符串 S 仅由大写字母
S和C组成,且不包含子串SCSC。 - 所有测试用例中 ∣S∣ 的总和不超过 200000。
输入解题思路,AI测评打分。不知道怎么写?