#K67212. Unique Tokens Collection
Unique Tokens Collection
Unique Tokens Collection
You are given a total of \(Q\) checkpoints and \(T\) participants. Each participant collects tokens from a range of checkpoints starting from a checkpoint \(s\) and ending at a checkpoint \(e\) (both inclusive). The number of unique tokens collected by a participant is given by the formula \(e - s + 1\). Your task is to determine the number of unique tokens collected by each participant.
Note: Although the total number of checkpoints \(Q\) is provided in the input, it does not affect the computation.
inputFormat
The input is given via standard input (stdin) in the following format:
- The first line contains two integers \(T\) and \(Q\), where \(T\) is the number of participants and \(Q\) is the total number of checkpoints.
- Each of the next \(T\) lines contains two integers \(s\) and \(e\), representing the starting and ending checkpoints (inclusive) for that participant.
All numbers are separated by spaces or newline characters.
outputFormat
Print a single line to standard output (stdout) containing \(T\) integers separated by spaces. Each integer represents the number of unique tokens collected by the corresponding participant. The result for each participant is computed using the formula:
[ e - s + 1 ]
sample
3 10
1 5
3 8
6 10
5 6 5