公式

J - ChannelTalk Workflow 解説 by sorohue


To answer all questions simultaneously, we first need time to assign each question to a different module. The fastest way to do this is to continuously halve the set of questions using a binary tree, which requires at least \(\lceil \lg N \rceil+1\) seconds.

There are several ways to delay the response time in a binary tree to a maximum of \(N-(\lceil \lg N \rceil+1)\) seconds. The intended solution is to create a cycle in each leaf module pointing to the next leaf module, and then appropriately rotate the positions of all leaf modules. Since this method can delay the response time by up to \(N-1\) seconds, it is sufficient to solve the problem.

投稿日時:
最終更新: