CF125C.Hobbits' Party
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Everyone knows that hobbits love to organize all sorts of parties and celebrations. There are n hobbits living in the Shire. They decided to organize the Greatest Party (GP) that would last for several days. Next day the hobbits wrote a guest list, some non-empty set containing all the inhabitants of the Shire. To ensure that everybody enjoy themselves and nobody gets bored, for any two days (say, days A and B) of the GP there existed at least one hobbit, invited to come on day A and on day B. However, to ensure that nobody has a row, for any three different days A, B, C there shouldn't be a hobbit invited on days A, B and C. The Shire inhabitants are keen on keeping the GP going for as long as possible. Your task is given number n, to indicate the GP's maximum duration and the guest lists for each day.
众所周知,霍比特人热衷于举办各种派对和庆祝活动。夏尔共有 n 位霍比特人居住。他们决定举办一场“最盛大的派对”(GP),持续若干天。次日,霍比特人们拟定了宾客名单——一个非空集合,包含夏尔的所有居民。为确保每位参与者都乐在其中、无人感到乏味,对于 GP 的任意两天(设为 A 天与 B 天),都至少存在一位霍比特人,被邀请在 A 天和 B 天均到场。然而,为避免发生争执,对于任意三天 A、B、C,不能存在某位霍比特人被邀请在这三天全部到场。夏尔的居民希望尽可能延长 GP 的持续时间。你的任务是:给定数字 n,求出 GP 的最大持续天数,并给出每一天的宾客名单。
输入格式
The first line contains an integer n (3 ≤ n ≤ 10000), representing the number of hobbits.
第一行包含一个整数 n(3 ≤ n ≤ 10000),表示霍比特人的数量。
输出格式
In the first output line print a number k — the maximum duration of GP in days. Then on k lines print the guest lists, (the guests should be separated by spaces). Print each guest list on the single line. Each list can contain an arbitrary positive number of hobbits. The hobbits are numbered with integers from 1 to n.
在第一行输出一个数字 k —— 即甘道夫派对(GP)的最大持续天数。随后的 k 行中,每行输出一个宾客名单(宾客之间用空格分隔)。每个宾客名单必须单独占一行。每个名单可包含任意正整数个霍比特人。霍比特人编号为从 1 到 n 的整数。
输入输出样例
输入#1
4
输出#1
3 1 2 1 3 2 3
输入#2
5
输出#2
3 1 2 1 3 2 3
输入解题思路,AI测评打分。不知道怎么写?