QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 512 MB Total points: 100 Interactive

#1670. 这算分吗?

Statistics

流行的即兴表演网站 Interpretation Impetus 定期举办即兴表演比赛,并维护着一份最佳表演者排名。然而,由于即兴表演经常会搞砸,该网站因频繁宣布比赛为“未评级”(unrated)而臭名昭著。现在,网站在每场即兴表演比赛前都会举行一场博彩,参与者尝试预测比赛最终是“已评级”(rated)还是“未评级”,这些博彩现在比即兴表演本身更受欢迎。

Izzy 和其他 $n$ 名参与者参加了每一场博彩。首先,他们每个人做出预测,用 $1$(“已评级”)或 $0$(“未评级”)表示。Izzy 总是最后做出预测,因此她在做出自己的预测时知道其他参与者的预测。随后,比赛正式进行,并宣布结果为“已评级”或“未评级”。

你需要编写一个程序,以交互方式扮演 Izzy。2021 年将举行 $m$ 场博彩,Izzy 的目标是在所有博彩结束后,她的错误预测次数不超过 $1.3 \cdot b + 100$,其中 $b$ 是所有其他博彩参与者在所有博彩结束后错误预测次数的最小值。

数字 $b$ 并非预先已知。Izzy 对其他参与者也一无所知——他们可能总是猜对,或者他们的预测可能存在相关性。然而,Izzy 的预测不会影响其他参与者的预测,也不会影响比赛是否评级的决定——换句话说,在每个测试用例中,无论你的程序输出什么,它接收到的输入总是相同的。

交互

首先,程序必须读取两个整数 $n$ ($1 \le n \le 1000$) 和 $m$ ($1 \le m \le 10\,000$)。然后,程序必须处理 $m$ 场博彩。对于每一场,程序必须首先读取一个由 $n$ 个 $0$ 和 $1$ 组成的字符串,其中第 $i$ 个字符表示第 $i$ 位参与者的猜测。然后,程序必须打印 Izzy 的猜测($0$ 或 $1$)。打印后请务必刷新输出!随后,程序必须读取实际结果(同样为 $0$ 或 $1$),如果这不是最后一场博彩,则继续处理下一场。

如果你的程序在所有博彩中犯下的错误次数不超过 $1.3 \cdot b + 100$(其中 $b$ 是任何其他参与者犯下的最小错误次数),则你的解法将被视为正确。注意,如果程序对某场博彩输出除 $0$ 或 $1$ 以外的任何内容,即使它没有犯其他错误,也会被视为错误。

本题共有 $200$ 个测试用例。

样例

输入格式 1

3 4
000
1
100
1
001
0
111
1

输出格式 1

0
0
1
1

说明

在样例中,参与者分别犯了 $1, 2, 3$ 次错误,因此 $b = 1$(这些数字中的最小值)。Izzy 犯了 $3$ 次错误,这不超过 $1.3 \cdot b + 100 = 101.3$,因此这些输出足以通过该测试用例(任何其他有效的输出也可以)。

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.