QOJ.ac

QOJ

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

#6668. Trokuti

Statistics

隐藏着一个恰好包含 100 个节点的图,节点编号为 1 到 100。你的目标是在有限次数的询问内重建该图。

一次询问由选择图中的三个不同节点组成,作为回答,你将得到在这三个节点中任意两个节点之间存在的边的数量。因此,每次询问的回答是 $0, 1, 2$ 或 $3$ 中的一个数。

图中的边是无向且无权的。因此,重建图意味着需要确定每一对节点之间是否存在边。

交互说明

这是一个交互式题目。你的程序需要与由出题方提供的程序进行交互,该程序会回答你提出的询问。

你的程序可以通过向标准输出写入内容来发送询问。每个询问应单独占一行,格式为:

? a b c

其中 $a, b, c$ 是满足 $1 \le a, b, c \le 100$ 的三个不同的正整数,表示本次询问选择的三个节点编号。

在输出每个询问后,你的程序需要刷新输出(flush),然后从标准输入读取该询问的回答——一个属于集合 ${0,1,2,3}$ 的整数,表示在所选三个节点之间存在的边数。

你的程序最多可以发送 161700 次这样的询问。

当你的程序重建完成整个图之后,需要在标准输出中单独一行输出字符 !,随后输出隐藏图的邻接矩阵。也就是说,需要输出 100 行,每行 100 个字符(01)。 第 $i$ 行第 $j$ 列的字符应为 1 当且仅当节点 $i$ 与节点 $j$ 之间存在边。

输出的矩阵必须是对称的,并且对角线上的元素必须为 0

之后,你的程序需要再次刷新输出并结束运行。

子任务

设 $Q$ 为你的程序所发送的询问次数。

  • 若 $Q > 161700$,你的程序将获得 0 分
  • 否则,得分按照下表计算:
询问次数范围 得分
$9900 \le Q \le 161700$ $10 + 10 \cdot \dfrac{161700 - Q}{161700 - 9900}$
$4950 \le Q \le 9900$ $20 + 10 \cdot \dfrac{9900 - Q}{9900 - 4950}$
$3400 \le Q \le 4950$ $30 + 70 \cdot \dfrac{4950 - Q}{4950 - 3400}$
$Q \le 3400$ $100$

样例数据

示例交互

尽管在正式题目中节点数量始终为 100,这里为了说明交互过程,给出一个节点数量为 4 的示例。

输出 输入 说明
? 1 2 3 0 在节点 1、2、3 之间不存在任何边
? 1 2 4 2 存在边 $(1,4)$ 和 $(2,4)$
? 1 3 4 2 存在边 $(1,4)$ 和 $(3,4)$
! 图已重建,接下来输出邻接矩阵
0001
0001
0001
1110

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.