A8698 | Practice
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Little time is left before Berland annual football championship. Therefore the coach of team "Losewille Rangers" decided to resume the practice, that were indefinitely interrupted for uncertain reasons. Overall there are $n$ players in "Losewille Rangers". Each player on the team has a number — a unique integer from 1 to $n$ . To prepare for the championship, the coach Mr. Floppe decided to spend some number of practices.
Mr. Floppe spent some long nights of his holiday planning how to conduct the practices. He came to a very complex practice system. Each practice consists of one game, all $n$ players of the team take part in the game. The players are sorted into two teams in some way. In this case, the teams may have different numbers of players, but each team must have at least one player.
The coach wants to be sure that after the series of the practice sessions each pair of players had at least one practice, when they played in different teams. As the players' energy is limited, the coach wants to achieve the goal in the least number of practices.
Help him to schedule the practices.
Mr. Floppe spent some long nights of his holiday planning how to conduct the practices. He came to a very complex practice system. Each practice consists of one game, all $n$ players of the team take part in the game. The players are sorted into two teams in some way. In this case, the teams may have different numbers of players, but each team must have at least one player.
The coach wants to be sure that after the series of the practice sessions each pair of players had at least one practice, when they played in different teams. As the players' energy is limited, the coach wants to achieve the goal in the least number of practices.
Help him to schedule the practices.
输入格式
A single input line contains integer $n$ ( $2<=n<=1000$ ).
输出格式
In the first line print $m$ — the minimum number of practices the coach will have to schedule. Then print the descriptions of the practices in $m$ lines.
In the $i$ -th of those lines print $f_{i}$ — the number of players in the first team during the $i$ -th practice ( $1<=f_{i}<n$ ), and $f_{i}$ numbers from $1$ to $n$ — the numbers of players in the first team. The rest of the players will play in the second team during this practice. Separate numbers on a line with spaces. Print the numbers of the players in any order. If there are multiple optimal solutions, print any of them.
In the $i$ -th of those lines print $f_{i}$ — the number of players in the first team during the $i$ -th practice ( $1<=f_{i}<n$ ), and $f_{i}$ numbers from $1$ to $n$ — the numbers of players in the first team. The rest of the players will play in the second team during this practice. Separate numbers on a line with spaces. Print the numbers of the players in any order. If there are multiple optimal solutions, print any of them.
输入输出样例
输入 #1
2
输出 #1
1 1 1
输入 #2
3
输出 #2
2 2 1 2 1 1
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted