| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 26 | 14 | 13 | 52.000% |
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, $N$ participants challenge $Q$ 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 $0$ points and $0$ coins. A participant that answers the $i$-th quiz gets $p_i$ points. Note that $p_i$ 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 $a$ to $b$ the participant gets $|a - b|$ coins, where $|x|$ means the absolute value of $x$. The point rank of a participant is defined as $1$ plus the number of participants who have points (properly) greater than the point of the participant. For example, initially, all the participants have rank $1$ since all the participants have $0$ 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 $Q$ quizzes: the $i$-th quiz was answered by participant $a_i$ and the point is $p_i$. 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 $Q$ quizzes from the record.
The input consists of a single test case of the following format.
$N$ $Q$
$a_1$ $p_1$
$\vdots$
$a_Q$ $p_Q$
The first line contains two numbers $N$ and $Q$, where $N$ is the number of participants ($1 \le N \le 10^5$) and $Q$ is the number of quizzes ($1 \le Q \le 10^5$). The $i$-th of the following $Q$ lines consists of two integers $a_i$ and $p_i$, which represent that the $i$-th quiz was answered by participant $a_i$ ($1 \le a_i \le N$) and the points of the $i$-th quiz is $p_i$ ($-10^9 \le p_i \le 10^9$).
Print $N$ lines, the $j$-th of which is the number of coins the $j$-th participant earned after all the $Q$ quizzes finish.
3 7 2 -1 1 4 2 5 3 6 1 -7 3 -6 2 9
2 6 5
9 5 2 10 2 -20 2 20 2 -20 2 20
5 32 5 5 5 5 5 5 5
5 10 1 0 3 0 2 0 5 0 4 0 1 0 3 0 2 0 5 0 4 0
0 0 0 0 0