Hey please help me to solve this question. Can anybody give me the source code which is executing and giving right output.
Shown in question below.? I am using DEV C++ and TURBO C 5.5 for compiling.
*Spaceman Spiff
Our super-hero, the fearless Spaceman Spiff, finds himself on the
planet closest to Star X-35 in his quest to wipe out the evil, vicious,
flagitious, heinous alien species that threatened to invade our planet! An
alien approaches...But in the blinding light, our hero can hardly make out
if its hostile. By the way it attacked Spiff's spaceship, he definitely was
hostile!
Spaceman Spiff, captured by vicious Zogwargs, is about to be
transported to the labor camp! But our hero hatches a bold plan!
At the last second, Spiff makes a break! Taking advantage of the planet's
weaker gravity, our hero is away like a shot... towards the infinite galaxy.
Finally away from the planet, only after planting a bomb powerful
enough to eradicate the entire Zogwargs species, Spiff wanders around,
head held high in victory. But wait, what does he notice? His star-o-meter showed him Star X-35's close and strange position relative to Star
Y-40!
He found that the level of a star was an amount of the stars that are
not higher and not to the right of the given star. He wanted to know the
distribution of the levels of the stars.
5
*
4
*
1 * 2 * 3
For example, look at the screenshot of Spiff's space-o-meter. Level of the
star number 5 is equal to 3 (it's formed by three stars with a numbers 1, 2
and 4). And the levels of the stars numbered by 2 and 4 are 1. At this map
there are only one star of thelevel 0, two stars of the level 1, one star of
the level 2, and one star of the level 3.
You are to write a program that will count the amounts of the stars of
each level on a given map and help Spaceman Spiff in cracking the code!
Input
The first line ofthe input contains a number of stars N (1 = N = 15000).
The following N lines describe coordinates of stars (two integers X and Y
per line separated by a space). There can be only one star at one point of
the plane. Stars are listed in ascending order of Y coordinate. Stars with
equal Y coordinates are listed in ascending order of X coordinate. Output
The output should contain N lines, one number per line. The first line
contains amount of the level 1 and level N-1.
Example Input: 5
1 1
5 1
7 1
3 3
5 5
Output: 1
2
1
1
Please reply.! Thanks.