2067 - 電機資節上機考 (2 Plant Flower) Scoreboard

Time

2020/06/15 18:30:00 2020/06/15 20:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12755 電機系上機考2

12755 - 電機系上機考2   

Description

  • 不能使用 STL
  • 請電機班學生連上線上教學 Teams,以便收到訊息
     
  • The simulation takes place in one matrix(X, Y). The seeds will be randomly planted into the matrix.
  • The seed is planted followed by the coordinate and what type of flower it is. If two seeds are planted too close, they will fight for nutrition hence grow fewerer flowers.
    • Ideally, with enough nutrition, each seed will grows eight flowers.
    • However, each seed in the orthogonally adjacent cell will reduce the number of flowers to one-half.
    • If there are seeds in more than 3 (i.e., 4) orthogonally adjacent cells, there will be no flowers.
  • Your goal is
    • to count the number of flowers in total
    • to provide the names of seeds, no matter blooming or not, planted in the target column

Input

You will receive several lines:

  • First line includes 3 numbers: the number of rows (of the garden matrix), the number of columns (of the garden matrix), target column.
  • Second line has an number, which means the number of seeds to plant.
  • And following lines will write in the format: inserted row, inserted column, flower name.
  • Each grid is planted at most once.

 

Output

  • First line is the total number of bloom flowers (No space at the end)
  • Second line is the names of seeds, no matter blooming or not, planted in the target column. (No space or ‘\n’ at the end)

 

Sample Input  Download

Sample Output  Download

Tags




Discuss