#K45857. Maximum Distinct Flowers
Maximum Distinct Flowers
Maximum Distinct Flowers
You are given a garden grid where each row represents a row of flower beds, and each cell contains an integer representing a flower type. Your task is to determine, for each row, the number of distinct flower types that can be planted.
For a given row with elements \(a_1, a_2, \dots, a_m\), the answer is given by \( \left| \{a_1, a_2, \dots, a_m\} \right| \), i.e., the cardinality of the set of flower types in that row.
The first line of input contains three integers \(n\), \(m\), and \(k\). Here, \(n\) is the number of rows, \(m\) is the number of columns, and \(k\) is an additional parameter (not used in the computation). This is followed by \(n\) lines, each containing \(m\) integers.
Your program should read from stdin and write the result to stdout. The output should be a single line with \(n\) space-separated integers, where each integer corresponds to the number of distinct flower types in the respective row.
inputFormat
The input begins with a line containing three integers (n), (m), and (k). This is followed by (n) lines, each containing (m) space-separated integers representing the flower types in that row.
outputFormat
Output a single line containing (n) space-separated integers. Each integer represents the count of distinct flower types in the corresponding row.## sample
3 3 3
1 1 2
2 3 3
3 2 1
2 2 3