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

34774번 - Frangolino ali na mesa 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.5 초 2048 MB111100.000%

문제

Washington, a chef enthusiastic about artificial intelligence and passionate about cooking, decided to build a waiter-robot for his new restaurant, Frangolino, which specializes in breaded chicken. Washington will open the restaurant for a special night with friends and decided to test the waiter-robot on that occasion.

The restaurant will serve $N$ tables, numbered from 1ドル$ to $N,ドル and will offer only one dish: chicken milanesa. Washington loves playing with words and decided to define two commands for the waiterrobot: the command “ali na mesa $X$” (go to table $X$) and the command “a milanesa $X$” (milanesa $X$).

The command “ali na mesa $X$” means that the waiter-robot should move to table $X$ and wait for the next instruction. The command “a milanesa $X$” means that the waiter-robot should register in the system an order for $X$ chicken milanesas for the table where it is currently located. At the beginning of the night, the waiter-robot is at table 1ドル$.

Unfortunately, the waiter-robot has a flaw and cannot handle anagrams properly. For each command received, the robot has a 50ドル\%$ chance of executing it correctly and a 50ドル\%$ chance of executing the other command. Your task is, given the history of commands received by the robot, to determine, for each table in the restaurant, the expected number of chicken milanesas that will be served.

입력

The first line of input contains two integers $N$ and $Q$ (1ドル ≤ N, Q ≤ 10^5$), the number of tables and the number of waiter-robot commands, respectively.

The second line contains $Q$ integers $X_1, \dots , X_Q$ (1ドル ≤ X_i ≤ N$) separated by spaces. Each $X_i$ describes the argument of one of the commands that the waiter-robot received, in the order they occurred.

Note that the command itself is not provided, since the waiter-robot will execute either one with 50ドル\%$ probability.

출력

The output should contain $N$ lines. The $i$-th line should contain the expected number of chicken milanesas that will be served at table $i,ドル as described below.

The expected value may not be an integer, but it will always be a rational number and, therefore, can be represented by an irreducible fraction $\frac{p} {q}$ . Since $p$ and $q$ can be very large, you should print $p \times q^{-1} \bmod {(10^9 + 7)},ドル where $q^{-1}$ is the multiplicative inverse of $q$ modulo 10ドル^9 + 7$.

제한

예제 입력 1

2 3
1 2 1

예제 출력 1

750000007
250000002

예제 입력 2

4 4
1 2 3 4

예제 출력 2

750000008
250000003
1
0

노트

출처

ICPC > Regionals > Latin America > Sub-Regional Brasil do ACM ICPC > Maratona SBC de Programação 2025 F번

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

출처

대학교 대회

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

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