Logo
(追記) (追記ここまで)

6960번 - Common Words 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB298726.923%

문제

Given a sequence of $m$ words from a newspaper article and an integer $k,ドル find the $k^\text{th}$ most common word(s).

입력

Input will consist of an integer $n$ followed by $n$ data sets. Each data set begins with a line containing $m$ and $k,ドル followed by $m$ lines, each containing a word of up to 20ドル$ lowercase letters. There will be no more than 1ドル,000円$ words per data set.

출력

For each input data set, determine the $k^\text{th}$ most common word(s). To be precise, a word $w$ is the $k^\text{th}$ most common if exactly $k-1$ distinct words occur more frequently than $w$ in the data set. Note that $w$ might be multiply defined (i.e. there is a tie for the $k^\text{th}$ most common word) or $w$ might not exist (i.e. there is no $k^\text{th}$ most common word). For each data set, print a title line indicating $k$ using normal ordinal notation (1st, 2nd, 3rd, 4th, 5th, …) followed by a number of lines giving all the possible values for the $k^\text{th}$ most common word. A blank line should follow the last word for each data set.

제한

예제 입력 1

3
7 2
the
brown
the
fox
red
the
red
1 3
the
2 1
the
wash

예제 출력 1

2nd most common word(s):
red
3rd most common word(s):
1st most common word(s):
the
wash

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 1999 > CCO 1999 2번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /