Skip to content

Instantly share code, notes, and snippets.

@mhmoodlan
Created November 30, 2017 09:29
Show Gist options
  • Save mhmoodlan/67a6a3a7aa8978bfc168890da5e1f6d0 to your computer and use it in GitHub Desktop.
Save mhmoodlan/67a6a3a7aa8978bfc168890da5e1f6d0 to your computer and use it in GitHub Desktop.
#Geometry #UVa #Solved
//https://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=1806
#include <bits/stdc++.h>
#define ll long long
#define sz(v) ((int) ((v).size()))
#define clr(v, d) memset(v, d, sizeof(v))
#define lp(i, n) for(int i = 0; i < (int)(n); ++i)
#define rep(i, v) for(int i = 0; i < sz(v); ++i)
using namespace std;
const int MAX = 200005;
int n, ollie, stan;
pair<int, int> a[MAX];
int main() {
while(cin>>n && n!=0) {
ollie = 0, stan = 0;
int x, y;
for(int i = 0 ; i < n ; i++) {
cin>>x>>y;
a[i] = make_pair(x, y);
}
int mx = a[n/2].first, my = a[n/2].second;
//cout << "mx = " << mx << " , my = " << my << endl;
for(int i = 0 ; i < n ; i++) {
x = a[i].first - mx;
y = a[i].second - my;
if(x > 0) {
if(y > 0) {
stan++;
}
if(y < 0) {
ollie++;
}
}
if(x < 0) {
if(y > 0) {
ollie++;
}
if(y < 0) {
stan++;
}
}
}
cout << stan << " " << ollie << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment