A9553 | Football Kit
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Consider a football tournament where $n$ teams participate. Each team has two football kits: for home games, and for away games. The kit for home games of the $i$ -th team has color $x_{i}$ and the kit for away games of this team has color $y_{i}$ $(x_{i}≠y_{i})$ .
In the tournament, each team plays exactly one home game and exactly one away game with each other team ( $n(n-1)$ games in total). The team, that plays the home game, traditionally plays in its home kit. The team that plays an away game plays in its away kit. However, if two teams has the kits of the same color, they cannot be distinguished. In this case the away team plays in its home kit.
Calculate how many games in the described tournament each team plays in its home kit and how many games it plays in its away kit.
In the tournament, each team plays exactly one home game and exactly one away game with each other team ( $n(n-1)$ games in total). The team, that plays the home game, traditionally plays in its home kit. The team that plays an away game plays in its away kit. However, if two teams has the kits of the same color, they cannot be distinguished. In this case the away team plays in its home kit.
Calculate how many games in the described tournament each team plays in its home kit and how many games it plays in its away kit.
输入格式
The first line contains a single integer $n$ $(2<=n<=10^{5})$ — the number of teams. Next $n$ lines contain the description of the teams. The $i$ -th line contains two space-separated numbers $x_{i}$ , $y_{i}$ $(1<=x_{i},y_{i}<=10^{5}; x_{i}≠y_{i})$ — the color numbers for the home and away kits of the $i$ -th team.
输出格式
For each team, print on a single line two space-separated integers — the number of games this team is going to play in home and away kits, correspondingly. Print the answers for the teams in the order they appeared in the input.
输入输出样例
输入 #1
2 1 2 2 1
输出 #1
2 0 2 0
输入 #2
3 1 2 2 1 1 3
输出 #2
3 1 4 0 2 2
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted