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

24610번 - Who Goes There? 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB2501109845.161%

문제

What happens when more teams want to go to an ICPC regional site than the site has capacity for? Who goes there?

One possible policy is the following: Every school is allowed to register as many teams as they wish. Accept every school's first team, then accept every school's second team (for schools with more than one team), then third, and so on, until all teams are accepted, or there isn't enough capacity for the next wave. Then, if there are extra spots available, the spots are given to schools, one by one, in the order that the schools registered.

Given the capacity of a site, the number of teams registered by each school and the order that they registered, determine how many teams from each school are accepted.

입력

The first line of input contains two integers $n$ (1ドル \le n \le 100$) and $m$ (1ドル \le m \le 100$), where $n$ is the capacity of the site and $m$ is the number of schools that wish to compete there.

Each of the next $m$ lines contains an integer $t$ (1ドル \le t \le 100$), which is the number of teams that a school has registered. The schools are listed in the order that they registered.

출력

Output $m$ lines, one for each school. Each line must contain a single integer indicating the number of teams accepted from that school. Output them in the same order as they appear in the input.

제한

예제 입력 1

20 5
7
5
1
6
12

예제 출력 1

5
5
1
5
4

힌트

출처

ICPC > Regionals > North America > South Central USA Regional > 2021 South Central USA Regional Contest > Division 2 L번

ICPC > Regionals > North America > Mid-Central Regional > Mid-Central USA Programming Contest 2021 J번

ICPC > Regionals > North America > Southeast USA Regional > 2021 Southeast USA Regional Programming Contest > Division 2 L번

  • 문제를 만든 사람: David Van Brackle
(追記) (追記ここまで)

출처

대학교 대회

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

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