Nothing bothers Bob more than when taller people stand up in front and block his view at sporting events. It
bothers him so much, that he has developed a measure for the displeasure that a crowd feels because of this
phenomenon. Most days, he calls his measure the Index of Identifiable Inversions. Although when his view is
blocked by this phenomenon, he calls it the "Down In Front" Aggravation Metric.
The measure works as follows. In a line of standing people, the measure is equal to the number of people who are
blocking others' views. Person A is blocking B's view, if
# A is taller than B
# A is standing in front of B
Assuming that everyone is standing, the line below has a "Down in Front" Aggravation Measure of 8. Bob's view is
blocked by Alice; Chuck's view is blocked by Bob and Alice; Dave's view is blocked by Chuck, Bob and Alice; and
Eve's view is blocked by Alice and Bob.
The input consists of an initial line with an integer n, 0 n < 10,000 on a line by itself representing the number of
people standing in line. The rest of the lines give the line configuration, starting at the front of the line and going
in order, in the following format:
The output of the program should be a single integer representing the Index of Indentifiable Inversions of the
Can someone help me on how to approach this program? I'm really lost. Any help is appreciated.