#C10049. Balanced Movies
Balanced Movies
Balanced Movies
We define a movie to be balanced if the number of upvotes equals the number of downvotes. Given the number of movies and their respective votes, your task is to determine how many balanced movies exist and to output the 1-indexed positions of these movies.
If there are any balanced movies, print the count on the first line, and the indices (separated by spaces) on the second line. If there are no balanced movies, output No balanced movies
(without quotes).
Note: Read input from standard input (stdin) and write output to standard output (stdout).
inputFormat
The input is given from standard input (stdin) and consists of:
- An integer
n
, the number of movies. - Followed by
n
lines, each containing two integers: the number of upvotes and the number of downvotes for a movie.
outputFormat
If there is at least one balanced movie, print the number of balanced movies on the first line and the 1-indexed positions of the balanced movies on the second line, separated by spaces.
If no movie is balanced, print No balanced movies
.
5
10 10
5 7
3 3
8 2
4 4
3
1 3 5
</p>