CF1286C1.Madhouse (Easy version)
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This problem is different with hard version only by constraints on total answers length
It is an interactive problem
Venya joined a tour to the madhouse, in which orderlies play with patients the following game. Orderlies pick a string s of length n, consisting only of lowercase English letters. The player can ask two types of queries:
- ? l r – ask to list all substrings of s[l..r]. Substrings will be returned in random order, and in every substring, all characters will be randomly shuffled.
- ! s – guess the string picked by the orderlies. This query can be asked exactly once, after that the game will finish. If the string is guessed correctly, the player wins, otherwise he loses.
The player can ask no more than 3 queries of the first type.
To make it easier for the orderlies, there is an additional limitation: the total number of returned substrings in all queries of the first type must not exceed (n+1)2.
Venya asked you to write a program, which will guess the string by interacting with the orderlies' program and acting by the game's rules.
Your program should immediately terminate after guessing the string using a query of the second type. In case your program guessed the string incorrectly, or it violated the game rules, it will receive verdict Wrong answer.
Note that in every test case the string is fixed beforehand and will not change during the game, which means that the interactor is not adaptive.
本题与难题版本的唯一区别在于对总答案长度的约束。
这是一道交互式题目。
维尼亚参加了一个前往疯人院的旅行,在那里,护工们会与病人玩如下游戏:护工们预先选定一个长度为 n 的字符串 s,该字符串仅由小写英文字母组成。玩家可以提出两类查询:
? l r—— 请求列出子串 s[l..r] 的所有子串。返回的子串顺序是随机的;且每个子串中的所有字符均被随机打乱顺序。! s—— 猜测护工所选的字符串。此类查询恰好只能执行一次,之后游戏即结束。若猜测正确,则玩家获胜;否则失败。
玩家最多可提出 3 次第一类查询(即 ? l r 类型)。
为方便护工,还存在一项额外限制:所有第一类查询所返回的子串总数不得超过 (n+1)2。
维尼亚请你编写一个程序,通过与护工的程序进行交互,并严格遵守游戏规则,来猜出该字符串。
你的程序在使用第二类查询(即 ! s)成功猜测字符串后,应立即终止。若你的程序猜测错误,或违反了游戏规则,则将被判为“答案错误”(Wrong answer)。
注意:在每个测试用例中,字符串在游戏开始前即已固定,且在整个游戏过程中不会改变,即交互器是非自适应的(non-adaptive)。
输入格式
First line contains number n (1≤n≤100) — the length of the picked string.
第一行包含一个整数 n(1≤n≤100)——所选字符串的长度。
输入输出样例
输入#1
4 a aa a cb b c c
输出#1
? 1 2 ? 3 4 ? 4 4 ! aabc
输入解题思路,AI测评打分。不知道怎么写?