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

6161번 - iCow 다국어

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

문제

Fatigued by the endless toils of farming, Farmer John has decided to try his hand in the MP3 player market with the new iCow. It is an MP3 player that stores N songs (1 <= N <= 1,000) indexed 1 through N that plays songs in a "shuffled" order, as determined by Farmer John's own algorithm:

Each song i has an initial rating R_i (1 <= R_i <= 10,000).

The next song to be played is always the one with the highest rating (or, if two or more are tied, the highest rated song with the lowest index is chosen).

After being played, a song's rating is set to zero, and its rating points are distributed evenly among the other N-1 songs.

If the rating points cannot be distributed evenly (i.e., they are not divisible by N-1), then the extra points are parceled out one at a time to the first songs on the list (i.e., R_1, R_2, etc. -- but not the played song) until no more extra points remain.

This process is repeated with the new ratings after the next song is played.

Determine the first T songs (1 <= T <= 1000) that are played by the iCow.

입력

  • Line 1: Two space-separated integers: N and T
  • Lines 2..N+1: Line i+1 contains a single integer: R_i

출력

  • Lines 1..T: Line i contains a single integer that is the i-th song that the iCow plays.

제한

예제 입력 1

3 4
10
8
11

예제 출력 1

3
1
2
3

힌트

출처

Olympiad > USA Computing Olympiad > 2007-2008 Season > USACO January 2008 Contest > Bronze 3번

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

출처

대학교 대회

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

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