309607: CF1705F. Mark and the Online Exam

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Mark and the Online Exam

题意翻译

马克正在维护包括 $n$ 道判断题的在线考试。然而,他丢失了所有的正确答案。他需要在他的考生生气之前找回答案。 幸运的是,他可以使用评测系统。因此,对于每次询问,您可以输入对于每个问题的答案,评测系统会输出有几个答案是正确的。 他没有足够的时间,所以他最多可以向评测系统询问 $675$ 次。请帮助马克确定答案。 请注意,正确答案是固定的,不会改变。

题目描述

Mark is administering an online exam consisting of $ n $ true-false questions. However, he has lost all answer keys. He needs a way to retrieve the answers before his client gets infuriated. Fortunately, he has access to the grading system. Thus, for each query, you can input the answers to all $ n $ questions, and the grading system will output how many of them are correct. He doesn't have much time, so he can use the grading system at most $ 675 $ times. Help Mark determine the answer keys. Note that answer keys are fixed in advance and will not change depending on your queries.

输入输出格式

输入格式


The first line of the input consists of an integer $ n $ ( $ 1\leq n\leq 1000 $ ) — the number of questions.

输出格式


After reading $ n $ , you can start making queries to the grading system. For each query, print a line containing a string $ s $ of length $ n $ consisting of only letters 'T' and 'F'. - $ s_i = $ 'T' means that you answer the $ i $ -question true. - $ s_i = $ 'F' means that you answer the $ i $ -question false. After a successful query, you should read an integer $ k $ ( $ 0\leq k\leq n $ ) — the number of correct answers. If you read $ n $ , then you found the answers, and your program should not make any more queries. If your program reads $ k = -1 $ instead of the number of correct answers, it means that you either made an invalid query or exceeded the query limits. Exit immediately after receiving $ -1 $ , and you will see Wrong answer verdict. Otherwise, you can get an arbitrary verdict because your solution will continue to read from a closed stream. After printing a query do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use: - fflush(stdout) or cout.flush() in C++; - System.out.flush() in Java; - flush(output) in Pascal; - stdout.flush() in Python; - see documentation for other languages. Hacks To hack, use the following format: The first line contains an integer $ n $ ( $ 1\leq n\leq 1000 $ ) — the number of questions. The second line contains a string $ s $ of length $ n $ consisting of only 'T' and 'F' — the answer key.

输入输出样例

输入样例 #1

3

1

3

输出样例 #1

FTT

TTF

输入样例 #2

4

0

3

4

输出样例 #2

FTFF

TTTT

TFTT

说明

The empty lines in the example are just for you to better understand the interaction process. You're not required to print them. In the first example, there are $ 3 $ questions, and the answer to each question is 'true', 'true', and 'false', respectively. - The first query, guessing the answers to be 'false', 'true', and 'true', respectively, guesses only one question — the $ 2 $ -nd question — correctly. - Then, in the second query, the program correctly guesses the answer key. The interaction ends here. In the second example, there are $ 4 $ questions, and the answer to each question is 'true', 'false', 'true', and 'true', respectively. - The first query guessed none of the questions correctly, resulting in the answer $ 0 $ . - The second query guessed the $ 1 $ -st, $ 3 $ -rd, and $ 4 $ -th question correctly, resulting in the answer $ 3 $ . - In the third query, the program correctly guesses the answer key. Then, the interaction ends.

Input

题意翻译

马克正在维护包括 $n$ 道判断题的在线考试。然而,他丢失了所有的正确答案。他需要在他的考生生气之前找回答案。 幸运的是,他可以使用评测系统。因此,对于每次询问,您可以输入对于每个问题的答案,评测系统会输出有几个答案是正确的。 他没有足够的时间,所以他最多可以向评测系统询问 $675$ 次。请帮助马克确定答案。 请注意,正确答案是固定的,不会改变。

Output

**题意翻译**

马克正在维护包括 $ n $ 道判断题的在线考试。然而,他丢失了所有的正确答案。他需要在他的考生生气之前找回答案。

幸运的是,他可以使用评测系统。因此,对于每次询问,您可以输入对于每个问题的答案,评测系统会输出有几个答案是正确的。

他没有足够的时间,所以他最多可以向评测系统询问 $ 675 $ 次。请帮助马克确定答案。

请注意,正确答案是固定的,不会改变。

**题目描述**

Mark is administering an online exam consisting of $ n $ true-false questions. However, he has lost all answer keys. He needs a way to retrieve the answers before his client gets infuriated.

Fortunately, he has access to the grading system. Thus, for each query, you can input the answers to all $ n $ questions, and the grading system will output how many of them are correct.

He doesn't have much time, so he can use the grading system at most $ 675 $ times. Help Mark determine the answer keys.

Note that answer keys are fixed in advance and will not change depending on your queries.

**输入输出格式**

**输入格式**

输入的第一行包含一个整数 $ n $ ( $ 1\leq n\leq 1000 $ ) —— 问题的数量。

**输出格式**

在读取 $ n $ 之后,您可以开始向评测系统提出查询。对于每个查询,打印一个长度为 $ n $ 的字符串 $ s $ ,只包含字母 'T' 和 'F'。

- $ s_i = 'T' $ 表示您回答第 $ i $ 个问题为真。
- $ s_i = 'F' $ 表示您回答第 $ i $ 个问题为假。

成功查询后,您应该读取一个整数 $ k $ ( $ 0\leq k\leq n $ ) —— 正确答案的数量。如果您读取 $ n $ ,则您找到了答案,您的程序不应再进行查询。

如果您的程序读取 $ k = -1 $ 而不是正确答案的数量,这意味着您进行了无效查询或超出了查询限制。在收到 $ -1 $ 后立即退出,您将看到错误的答案判断。否则,您可能会得到任意判断,因为您的解决方案将继续从已关闭的流中读取。

在打印查询后不要忘记输出换行符并刷新输出。否则,您将得到空闲时间限制超出的判断。为此,请使用:

- 在 C++ 中使用 fflush(stdout) 或 cout.flush();
- 在 Java 中使用 System.out.flush();
- 在 Pascal 中使用 flush(output);
- 在 Python 中使用 stdout.flush();
- 查看其他语言的文档了解如何操作。

**输入输出样例**

**输入样例 #1**
```
3
1
3
```
**输出样例 #1**
```
FTT
TTF
```
**输入样例 #2**
```
4
0
3
4
```
**输出样例 #2**
```
FTFF
TTTT
TFTT
```

**说明**

示例中的空行只是为了让您更好地理解交互过程。您不需要打印它们。

在第一个示例中,有 $ 3 $ 个问题,每个问题的答案分别是 'true','true' 和 'false'。

- 第一次查询,猜测答案分别是 'false','true' 和 'true',只猜对了一个问题——第 $ 2 $ 个问题。
- 然后,在第二次查询中,程序正确猜出了答案键。交互在这里结束。

在第二个示例中,有 $ 4 $ 个问题,每个问题的答案分别是 'true','false','true' 和 'true'。

- 第一次查询没有猜对任何问题,答案为 $ 0 $。
- 第二次查询猜对了第 $ 1 $,$ 3 $ 和 $ 4 $ 个问题,答案为 $ 3 $。
- 在第三次查询中,程序正确猜出了答案键。然后,交互结束。**题意翻译** 马克正在维护包括 $ n $ 道判断题的在线考试。然而,他丢失了所有的正确答案。他需要在他的考生生气之前找回答案。 幸运的是,他可以使用评测系统。因此,对于每次询问,您可以输入对于每个问题的答案,评测系统会输出有几个答案是正确的。 他没有足够的时间,所以他最多可以向评测系统询问 $ 675 $ 次。请帮助马克确定答案。 请注意,正确答案是固定的,不会改变。 **题目描述** Mark is administering an online exam consisting of $ n $ true-false questions. However, he has lost all answer keys. He needs a way to retrieve the answers before his client gets infuriated. Fortunately, he has access to the grading system. Thus, for each query, you can input the answers to all $ n $ questions, and the grading system will output how many of them are correct. He doesn't have much time, so he can use the grading system at most $ 675 $ times. Help Mark determine the answer keys. Note that answer keys are fixed in advance and will not change depending on your queries. **输入输出格式** **输入格式** 输入的第一行包含一个整数 $ n $ ( $ 1\leq n\leq 1000 $ ) —— 问题的数量。 **输出格式** 在读取 $ n $ 之后,您可以开始向评测系统提出查询。对于每个查询,打印一个长度为 $ n $ 的字符串 $ s $ ,只包含字母 'T' 和 'F'。 - $ s_i = 'T' $ 表示您回答第 $ i $ 个问题为真。 - $ s_i = 'F' $ 表示您回答第 $ i $ 个问题为假。 成功查询后,您应该读取一个整数 $ k $ ( $ 0\leq k\leq n $ ) —— 正确答案的数量。如果您读取 $ n $ ,则您找到了答案,您的程序不应再进行查询。 如果您的程序读取 $ k = -1 $ 而不是正确答案的数量,这意味着您进行了无效查询或超出了查询限制。在收到 $ -1 $ 后立即退出,您将看到错误的答案判断。否则,您可能会得到任意判断,因为您的解决方案将继续从已关闭的流中读取。 在打印查询后不要忘记输出换行符并刷新输出。否则,您将得到空闲时间限制超出的判断。为此,请使用: - 在 C++ 中使用 fflush(stdout) 或 cout.flush(); - 在 Java 中使用 System.out.flush(); - 在 Pascal 中使用 flush(output); - 在 Python 中使用 stdout.flush(); - 查看其他语言的文档了解如何操作。 **输入输出样例** **输入样例 #1** ``` 3 1 3 ``` **输出样例 #1** ``` FTT TTF ``` **输入样例 #2** ``` 4 0 3 4 ``` **输出样例 #2** ``` FTFF TTTT TFTT ``` **说明** 示例中的空行只是为了让您更好地理解交互过程。您不需要打印它们。 在第一个示例中,有 $ 3 $ 个问题,每个问题的答案分别是 'true','true' 和 'false'。 - 第一次查询,猜测答案分别是 'false','true' 和 'true',只猜对了一个问题——第 $ 2 $ 个问题。 - 然后,在第二次查询中,程序正确猜出了答案键。交互在这里结束。 在第二个示例中,有 $ 4 $ 个问题,每个问题的答案分别是 'true','false','true' 和 'true'。 - 第一次查询没有猜对任何问题,答案为 $ 0 $。 - 第二次查询猜对了第 $ 1 $,$ 3 $ 和 $ 4 $ 个问题,答案为 $ 3 $。 - 在第三次查询中,程序正确猜出了答案键。然后,交互结束。

加入题单

算法标签: