MFP: Most Fluctuated Player
시간 제한2초메모리 제한1024 MB
퀴즈 Q개가 끝날 때마다 참가자의 점수가 바뀌고 순위가 다시 매겨질 때, 각 참가자가 얻는 코인은 순위 변동의 절댓값이다. 모든 퀴즈가 끝난 뒤 참가자별 코인 합계를 구한다.
문제
In this unstable world, people who are not afraid of instability will win. Thus it's natural to have a contest that values Most Fluctuated Player (MFP), a player whose rank is most fluctuated during the contest.
International Change Promotion Contest (ICPC) is one of such contests. In this contest, participants challenge quizzes. This contest uses two types of tokens: points and coins. Points are for evaluation of quiz ability itself, but coins are for evaluation of fluctuation. So coins are more important because it directly affects final results.
Each participant initially has points and coins. A participant that answers the -th quiz gets points. Note that can be negative; it's fine because the focus of the contest is instability (coins), not points. Point ranking is calculated every time after each quiz finishes, and each participant gets coins based on fluctuation of their point rank: if a participant's point rank is changed from to the participant gets coins, where means the absolute value of . The point rank of a participant is defined as plus the number of participants who have points (properly) greater than the point of the participant. For example, initially, all the participants have rank since all the participants have points and thus none has points greater than others.
You, as an organizer of ICPC, have a record of a past contest. The record contains information about quizzes: the -th quiz was answered by participant and the point is . But the record doesn't contain the final results: the coins each participant earned in the end. Your task is to write a program to compute the numbers of coins of all the participants after quizzes from the record.
입력
The input consists of a single test case of the following format.
The first line contains two numbers and , where is the number of participants () and is the number of quizzes (). The -th of the following lines consists of two integers and , which represent that the -th quiz was answered by participant () and the points of the -th quiz is ().
출력
Print lines, the -th of which is the number of coins the -th participant earned after all the quizzes finish.