Codeforces Round 113 (Div. 2)
A
Rank List
Codeforces
1100
原题
←B →
翻译中…

Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.

翻译中…

You know the rules of comparing the results of two given teams very well. Let's say that team $*a*$ solved $*p*_{*a*}$ problems with total penalty time $*t*_{*a*}$ and team $*b*$ solved $*p*_{*b*}$ problems with total penalty time $*t*_{*b*}$. Team $*a*$ gets a higher place than team $*b*$ in the end, if it either solved more problems on the contest, or solved the same number of problems but in less total time. In other words, team $*a*$ gets a higher place than team $*b*$ in the final results' table if either $*p*_{*a*} > *p*_{*b*}$, or $*p*_{*a*} = *p*_{*b*}$ and $*t*_{*a*} < *t*_{*b*}$.

翻译中…

It is considered that the teams that solve the same number of problems with the same penalty time share all corresponding places. More formally, let's say there is a group of $*x*$ teams that solved the same number of problems with the same penalty time. Let's also say that $*y*$ teams performed better than the teams from this group. In this case all teams from the group share places $*y* + 1$, $*y* + 2$, $...$, $*y* + *x*$. The teams that performed worse than the teams from this group, get their places in the results table starting from the $*y* + *x* + 1$-th place.

翻译中…

Your task is to count what number of teams from the given list shared the $*k*$-th place.

翻译中…

Input

翻译中…

The first line contains two integers $*n*$ and $*k*$ ($1 ≤ *k* ≤ *n* ≤ 50$). Then $*n*$ lines contain the description of the teams: the $*i*$-th line contains two integers $*p*_{*i*}$ and $*t*_{*i*}$ ($1 ≤ *p*_{*i*}, *t*_{*i*} ≤ 50$) — the number of solved problems and the total penalty time of the $*i*$-th team, correspondingly. All numbers in the lines are separated by spaces.

翻译中…

Output

翻译中…

In the only line print the sought number of teams that got the $*k*$-th place in the final results' table.

翻译中…

Note

翻译中…

The final results' table for the first sample is:

翻译中…
  • 1-3 places — 4 solved problems, the penalty time equals 10
  • 4 place — 3 solved problems, the penalty time equals 20
  • 5-6 places — 2 solved problems, the penalty time equals 1
  • 7 place — 1 solved problem, the penalty time equals 10
翻译中…

The table shows that the second place is shared by the teams that solved 4 problems with penalty time 10. There are 3 such teams.

翻译中…

The final table for the second sample is:

翻译中…
  • 1 place — 5 solved problems, the penalty time equals 3
  • 2-5 places — 3 solved problems, the penalty time equals 1
翻译中…

The table shows that the fourth place is shared by the teams that solved 3 problems with penalty time 1. There are 4 such teams.

翻译中…

样例

Input #1
7 2
4 10
4 10
4 10
3 20
2 1
2 1
1 10
Output #1
3
InputCopy OutputCopy
Input #2
5 4
3 1
3 1
5 3
3 1
3 1
Output #2
4
InputCopy OutputCopy
题目信息
题号
166A
时间限制
2 s
内存限制
256 MB
标签
二分
模拟
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。