#K78877. Minimal Known Planets
Minimal Known Planets
Minimal Known Planets
In this problem, you are given ( n ) planets numbered from 1 to ( n ). Initially, the characteristics of ( k ) planets are known. The remaining planets' characteristics can be predicted if enough initial data is provided. Specifically, if no planet's characteristic is known initially (i.e. ( k = 0 )), then all ( n ) planets must be 'learned' externally. However, if one or more characteristics are known (i.e. ( k > 0 )), then these are assumed to be sufficient for prediction, and the answer is simply ( k ).
Your task is to compute and output the minimal number of planet characteristics that need to be known initially in order to predict the characteristics of all ( n ) planets.
inputFormat
The input is provided via standard input (stdin) and consists of multiple lines. The first line contains two integers ( n ) and ( k ) separated by a space, where ( n ) is the total number of planets and ( k ) is the number of planets whose characteristics are initially known. The next ( k ) lines each contain an integer and a string, representing the position of the planet and its characteristic respectively. If ( k = 0 ), there are no additional lines.
outputFormat
Output a single integer to the standard output (stdout) representing the minimal number of planet characteristics that need to be known initially.## sample
4 1
2 ATG
1
</p>