PDP-24 (2012) - Phase C' - 1 (loutraki)

View as PDF

Submit solution

Points: 25 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem types
Allowed languages
C, C++, Java, Pascal, Python

Loutraki

Loutraki has a beautiful beach in front of it and the Gerania mountains on the other side. A hotel in Loutraki is considered privileged when it has a view of both the sea and the mountain, meaning it has a clear view of both without any other hotel interfering in either direction.

We consider hotels as points on the plane with known coordinates X and Y. Hotel A obstructs the view of hotel B if, on one coordinate, A and B have equal values, and on the other coordinate, A has a smaller value than B.

Problem:

Develop a program in one of the IOI languages which: after reading the number and coordinates of the hotels in Loutraki, will calculate how many privileged hotels there are.

Input File:

The input files named loutraki.in are text files with the following structure: The first line contains an integer N\;(1 \le N \le 1.000.000), the number of hotels. Each of the next N lines contains two integers X and Y, separated by a single space, representing the coordinates of the corresponding hotel (-100.000 \le X,Y \le 100.000). There will be no two hotels located at the same point.

Output File:

The output files named loutraki.out are text files with the following structure: they have one line with exactly one number: the number of privileged hotels.

Examples of Input - Output Files:

STDIN (loutraki.in)

9
1 8
4 8
8 8
6 6
1 4
4 4
6 4
8 2
4 1

STDOUT (loutraki.out)

3

pdp-2012-C1.svg

Explanation of the Example

The privileged hotels are: H5, H8 and H9.

Formatting: In the output, each line terminates with a newline character.
Maximum execution time: 2 sec.
Maximum available memory: 64 MB.


Comments

There are no comments at the moment.