QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 1024 MB Total points: 100 Communication

#7115. 你能猜出我的序列吗?

Statistics

这是一个交互题。

Alice 有一个序列 $a_1, a_2, \dots, a_n$,满足以下性质:

  • $a_1 < a_2 < \dots < a_n$
  • 对于所有 $1 \le i \le n$,满足 $0 \le a_i < 20$。

Alice 想要将她的序列传送给 Bob。为此,她可以向 Bob 传送一个范围在 $[0, 10^9]$ 内的整数 $x$。请帮助他们找到任何一种策略!

交互

在本题中,你的程序在每个测试点中会被运行两次。

第一轮

在第一轮中,你的程序将扮演 Alice 的角色。你需要从输入中读取序列,并输出一个整数,表示你想要传送的数字。

输入格式

第一行包含一个字符串 Alice,表示本轮的角色。 下一行包含一个整数 $n$,表示序列的长度。 下一行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$,表示该序列。 保证 $a_1 < a_2 < \dots < a_n$ 且对于所有 $1 \le i \le n$ 有 $0 \le a_i < 20$。

输出格式

输出一行,包含一个整数 $x$ ($0 \le x \le 10^9$),表示 Alice 应该传送给 Bob 的数字。

第二轮

在第二轮中,你的程序将扮演 Bob 的角色。你需要从输入中读取数字 $x$,并输出你恢复出的序列。

输入格式

第一行包含一个字符串 Bob,表示本轮的角色。 下一行包含一个整数 $x$ ($0 \le x \le 10^9$),表示 Alice 传送给 Bob 的数字。

输出格式

第一行包含一个整数 $n$,表示你恢复出的序列的长度。 下一行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$,表示你恢复出的序列。

样例

样例输入 1

Alice
6
2 3 5 8 10 15

样例输出 1

1024

样例输入 2

Bob
1024

样例输出 2

6
2 3 5 8 10 15

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.