Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef pair <int, int> pii;
- typedef long long ll;
- #define mp make_pair
- #define f first
- #define s second
- #define pb push_back
- #define sz(x) (int)((x).size())
- #define all(x) (x).begin(), (x).end()
- #define fo(i, n) for(int i = 1; i <= (int)n; ++i)
- #define rep(i, a, b) for(int i = (int)a; i < (int)b; ++i)
- const int inf = 1e9 + 7;
- const ll INF = 1e18 + 7;
- ll n, A, B, ans;
- struct point{
- ll x, y;
- point(ll _x = 0, ll _y = 0){
- x = _x;
- y = _y;
- }
- void read(){
- cin >> x >> y;
- }
- point operator -(const point &p) const{
- return point(x - p.x, y - p.y);
- }
- ll operator *(const point &p) const{
- return (ll)x * p.y - (ll)y * p.x;
- }
- ll operator %(const point &p) const{
- return (ll)x * p.x + (ll)y * p.y;
- }
- bool sign() const{
- return y > 0 || (y == 0 && x > 0);
- }
- bool operator < (const point &p) const{
- if(sign() != p.sign()){
- return sign() > p.sign();
- }
- return (*this * p) > 0;
- }
- }p[100100], b[100100];
- int main() {
- #ifdef LOCAL
- freopen("in", "r", stdin);
- freopen("out", "w", stdout);
- #endif
- cin >> n >> A >> B;
- for(int i = 0; i < n; ++i){
- p[i].read();
- }
- for(int i = 0; i < n; ++i){
- for(int j = i + 1; j < n; ++j){
- for(int k = j + 1; k < n; ++k){
- if(((p[i] -p[k]) % (p[j] - p[k]) == 0)){
- ll cur = abs((p[i] - p[k]) * (p[j] - p[k]));
- if(cur >= 2 * A && cur <= 2 * B){ ans++;
- //cerr << p[k].x << " " << p[k].y << " " << p[i].x << " " << p[i].y << " " << p[j].x << " " << p[j].y << endl;
- }
- }
- if(((p[i] - p[j]) % (p[k] - p[j]) == 0)){
- ll cur = abs((p[i] - p[j]) * (p[k] - p[j]));
- if(cur >= 2 * A && cur <= 2 * B){ ans++;
- //cerr << p[j].x << " " << p[j].y << " " << p[i].x << " " << p[i].y << " " << p[k].x << " " << p[k].y << endl;
- }
- }
- if(((p[k] - p[i]) % (p[j] - p[i]) == 0)){
- ll cur = abs((p[k] - p[i]) * (p[j] - p[i]));
- if(cur >= 2 * A && cur <= 2 * B) {ans++;
- //cerr << p[i].x << " " << p[i].y << " " << p[j].x << " " << p[j].y << " " << p[k].x << " " << p[k].y << endl;
- }
- }
- }
- }
- }
- cout << ans << endl;
- /*for(int i = 0; i < n; ++i){
- int cnt = 0;
- for(int j = 0; j < n; ++j){
- if(i == j) continue;
- b[cnt] = p[j] - p[i];
- cnt++;
- }
- sort(b, b + cnt);
- /*int r = 0;
- for(int l = 0; l < cnt; ++l){
- r = max(r , l);
- //cout << b[l] % b[(r + l) % cnt] << endl;
- while(r < cnt && b[l] % b[(r + l) % cnt] == 0){
- ll area = abs(b[l] * b[(r + l) % cnt]);
- if(area >= 2 * A && area <= 2 * B){
- ans++;
- }
- r++;
- }
- r--;
- }
- int r = 1;
- /*
- for(int l = 0; l < cnt; ++l)
- {
- r = max(r, l + 1);
- while(r < cnt && b[l] % b[r] != 0)
- ++r;
- int t = r;
- while(t < cnt && b[l] % b[t] == 0)
- {
- ll area = abs(b[l] * b[t]);
- if(area >= 2 * A && area <= 2 * B)
- ++ans;
- ++t;
- }
- }
- for(int j = 0; j < cnt; ++j){
- for(int k = j + 1; k < cnt; ++k){
- if(b[j] % b[k] == 0){
- ll area = abs(b[j] * b[k]);
- if(area >= 2 * A && area <= 2 * B){
- // cerr<<i<<' '<<p[i].x<<' '<<p[i].y<<' '<< b[j].x+p[i].x<<' '<<b[j].y+p[i].y<<' '<<b[k].x+p[i].x<<' '<<b[k].y + p[i].y<<endl;
- // cerr<<"! "<<b[j].x<<' '<<b[j].y<<' '<<b[k].x<<' '<<b[k].y<<endl;
- cerr<<i<<' '<<j<<' '<<k<<' '<<b[j]%b[k]<<endl;
- ans++;
- }
- }
- }
- }
- }*/
- #ifdef LOCAL
- cerr << endl << clock() * 1000 / CLOCKS_PER_SEC << " ms.\n";
- #endif
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement