Problem A: Brownie Points I

Those lines divide the plane into four quadrants. The quadrantcontaining points with arbitrarily large positive coordinates is thetop-right quadrant.
The players score according to the number of brownie points in thequadrants. If a brownie point is crossed by a line, it doesn'tcount. Stan gets a point for each (uncrossed) brownie point in thetop-right and bottom-left quadrants. Ollie gets a point for each(uncrossed) brownie point in the top-left and bottom-right quadrants.
Your task is to compute the scores of Stan and Ollie given the pointthrough which they draw their lines.
Input contains a number of test cases. The data of each test caseappear on a sequence of input lines. The first line of each test casecontains a positive odd integer1 < n < 200000 which is the numberof brownie points. Each of the following n lines containstwo integers, the horizontal (x) and vertical (y)coordinates of a brownie point. No two brownie points occupy the sameplace. The input ends with a line containing 0 (instead of then of a test).
For each test case of input, print a line with two numbers separatedby a single space. The first number is Stan's score, the second is the score of Ollie when their lines cross the point whose coordinatesare given at the center of the input sequence of points for this case.
Sample input
11 3 2 3 3 3 4 3 6 2 -2 1 -3 0 0 -3 -3 -3 -2 -3 -4 3 -7 0
Output for sample input
6 3
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
public class Main
{
public static final boolean DEBUG = false;
public StreamTokenizer tokenizer;
public BufferedReader cin;
public PrintWriter cout;
public int n;
public Point[] point;
static class Point
{
int x, y;
}
public void init()
{
try {
if (DEBUG) {
cin = new BufferedReader(new InputStreamReader(
new FileInputStream("d:\\OJ\\uva_in.txt")));
} else {
cin = new BufferedReader(new InputStreamReader(System.in));
}
cout = new PrintWriter(new OutputStreamWriter(System.out));
tokenizer = new StreamTokenizer(cin);
} catch (Exception e) {
e.printStackTrace();
}
}
public String next()
{
try {
tokenizer.nextToken();
if (tokenizer.ttype == StreamTokenizer.TT_EOF) return null;
else if (tokenizer.ttype == StreamTokenizer.TT_NUMBER) return String.valueOf((int)tokenizer.nval);
else if (tokenizer.ttype == StreamTokenizer.TT_WORD) return tokenizer.sval;
else return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public boolean input()
{
n = Integer.parseInt(next());
if (n == 0) return false;
point = new Point[n];
for (int i = 0; i < n; i++) {
point[i] = new Point();
point[i].x = Integer.parseInt(next());
point[i].y = Integer.parseInt(next());
}
return true;
}
public void solve()
{
int x = point[n / 2].x, y = point[n / 2].y;
int s = 0, o = 0;
for (int i = 0; i < n; i++) {
if ((point[i].x > x && point[i].y > y) || (point[i].x < x && point[i].y < y)) s++;
if ((point[i].x < x && point[i].y > y) || (point[i].x > x && point[i].y < y)) o++;
}
cout.println(s + " " + o);
cout.flush();
}
public static void main(String[] args)
{
Main solver = new Main();
solver.init();
while (solver.input()) {
solver.solve();
}
}
}