#K9321. Game Night Scoreboard Simulation

    ID: 38369 Type: Default 1000ms 256MiB

Game Night Scoreboard Simulation

Game Night Scoreboard Simulation

You are tasked with simulating a game night event. The simulation involves processing a series of events and updating a scoreboard accordingly. There are several types of events:

  • Type 1: "1 X" adds a new player with skill level X. The player's score is initially 0.
  • Type 2: "2 p g" indicates that the p-th player attempts game g. Each game has a corresponding difficulty level. If the player’s skill level is greater than or equal to the difficulty of game g (given by \(d_g\)), the player's score increases by 1.
  • Type 3: "3" prints the current scoreboard. The scoreboard prints the scores of all players in the order they were added, separated by a space. If there are multiple print events, output each on a new line.

You are given a total of \(n\) games (with difficulty levels provided) and \(m\) events. Process the events in order and output the required scoreboard when a print event occurs.

Note: The difficulty levels for games are given in order from game 1 to game \(n\). For an attempt event, treat the game index as 1-indexed and similarly the player index as the order of addition (1-indexed).

inputFormat

The first line contains two integers \(n\) and \(m\) where \(n\) is the number of games and \(m\) is the number of events.

The second line contains \(n\) integers denoting the difficulty levels of the games \(d_1, d_2, \ldots, d_n\).

The next \(m\) lines each represent an event in one of the following formats:

  • "1 X" — Add a new player with skill level X.
  • "2 p g" — The p-th player attempts game g. (Both p and g are 1-indexed.)
  • "3" — Print the current scoreboard.

outputFormat

For each event of type 3, print a single line with the scores of all players (in the order of addition), separated by a space.

## sample
4 7
3 5 2 7
1 4
1 6
2 1 2
2 2 1
2 1 1
3
2 2 3
1 1