A1378 | [COCI-2020-2021-contest1]#5 Tenis
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Mirko is a big fan of tennis. Soon an important tournament with n players will take place. Mirko has spent years researching tennis players and has collected various statistics about the competitors. He has ranked their ability on three different courts: grass, clay and hard. More precisely, for each court he has determined the order (rank list) of the players, with the first player being the strongest, and the last being the weakest.
On this tournament, every player will play against every other player exactly once, so there will be n(n−1)
2 matches in total. A tennis match cannot end in a draw, and the player who is stronger on the court the match is played on will win. The organisers know that, so they have decided that each match should be played on the court for which the winner will be the strongest, i.e. have the best position in the corresponding rank list. If some courts are equal in that sense (the position of the winner of the match between players A and B would be the same, e.g. player A would win on court 1, and player B on court 2, and they are both ranked third on the corresponding court rank lists), they will choose the court for which the loser would have the best position. If the courts are still equal, the one with the smallest index is chosen.
Determine the outcome of this tournament: the number of matches played on each court and the number of wins for each player.
On this tournament, every player will play against every other player exactly once, so there will be n(n−1)
2 matches in total. A tennis match cannot end in a draw, and the player who is stronger on the court the match is played on will win. The organisers know that, so they have decided that each match should be played on the court for which the winner will be the strongest, i.e. have the best position in the corresponding rank list. If some courts are equal in that sense (the position of the winner of the match between players A and B would be the same, e.g. player A would win on court 1, and player B on court 2, and they are both ranked third on the corresponding court rank lists), they will choose the court for which the loser would have the best position. If the courts are still equal, the one with the smallest index is chosen.
Determine the outcome of this tournament: the number of matches played on each court and the number of wins for each player.
输入格式
The first line contains an integer n, the number of players. The players are labeled with integers from 1 to n.
The i-th of the following three lines contains a permutation of integers from 1 to n, the rank list of the players for the i-th surface, starting with the strongest player.
The i-th of the following three lines contains a permutation of integers from 1 to n, the rank list of the players for the i-th surface, starting with the strongest player.
输出格式
In the first line, print the number of matches played on the first, second and third surface.
In the second line, print the number of matches won by each player from 1 to n.
In the second line, print the number of matches won by each player from 1 to n.
输入输出样例
输入 #1
3 3 2 1 1 3 2 3 2 1
输出 #1
1 2 0 2 0 1
Clarification of the first example:
The match between players 1 and 2 is played on court 2, because the winner (player 1) has the best (first)
position. For the match between playes 1 and 3, the winner has the same position on all three courts, but
the loser has a better position on court 2. For the match between players 2 and 3, court 1 and 3 are equal,
so the one with the smaller index is chosen (court 1).
The match between players 1 and 2 is played on court 2, because the winner (player 1) has the best (first)
position. For the match between playes 1 and 3, the winner has the same position on all three courts, but
the loser has a better position on court 2. For the match between players 2 and 3, court 1 and 3 are equal,
so the one with the smaller index is chosen (court 1).
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted