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

21149번 - Unread Messages 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB151635948.760%

문제

There is a group of people in an internet email message group. Messages are sent to all members of the group, and no two messages are sent at the same time.

Immediately before a person sends a message, they read all their unread messages up to that point. Each sender also reads their own message the moment it is sent. Therefore, a person’s unread messages are exactly the set of messages sent after that person’s last message.

Each time a message is sent, compute the total number of unread messages over all group members.

입력

The first line of input contains two integers $n$ (1ドル \le n \le 10^9$) and $m$ (1ドル \le m \le 1,000$), where $n$ is the number of people in the group, and $m$ is the number of messages sent. The group members are identified by number, 1ドル$ through $n$.

Each of the next $m$ lines contains a single integer $s$ (1ドル \le s \le n$), which is the sender of that message. These lines are in chronological order.

출력

Output $m$ lines, each with a single integer, indicating the total number of unread messages over all group members, immediately after each message is sent.

제한

예제 입력 1

2 4
1
2
1
2

예제 출력 1

1
1
1
1

예제 입력 2

3 9
1
2
3
2
1
3
3
2
1

예제 출력 2

2
3
3
4
3
3
5
4
3

힌트

출처

ICPC > Regionals > North America > Southeast USA Regional > 2020 Southeast USA Regional Programming Contest P번

ICPC > Regionals > North America > Mid-Central Regional > 2020 Mid-Central Regional Programming Contest M번

ICPC > Regionals > North America > Mid-Atlantic Regional > 2020 Mid-Atlantic USA Regional Contest B번

ICPC > Regionals > North America > South Central USA Regional > 2020 South Central USA Regional Contest P번

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

출처

대학교 대회

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

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