Advertisement
Guest User

asl

a guest
Aug 28th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. typedef pair <int, int> pii;
  6. typedef long long ll;
  7.  
  8. #define mp make_pair
  9. #define f first
  10. #define s second
  11. #define pb push_back
  12. #define sz(x) (int)((x).size())
  13. #define all(x) (x).begin(), (x).end()
  14.  
  15. #define fo(i, n) for(int i = 1; i <= (int)n; ++i)
  16. #define rep(i, a, b) for(int i = (int)a; i < (int)b; ++i)
  17.  
  18. const int inf = 1e9 + 7;
  19. const ll INF = 1e18 + 7;
  20.  
  21. ll n, A, B, ans;
  22.  
  23. struct point{
  24. ll x, y;
  25. point(ll _x = 0, ll _y = 0){
  26. x = _x;
  27. y = _y;
  28. }
  29. void read(){
  30. cin >> x >> y;
  31. }
  32. point operator -(const point &p) const{
  33. return point(x - p.x, y - p.y);
  34. }
  35.  
  36. ll operator *(const point &p) const{
  37. return (ll)x * p.y - (ll)y * p.x;
  38. }
  39. ll operator %(const point &p) const{
  40. return (ll)x * p.x + (ll)y * p.y;
  41. }
  42. bool sign() const{
  43. return y > 0 || (y == 0 && x > 0);
  44. }
  45. bool operator < (const point &p) const{
  46. if(sign() != p.sign()){
  47. return sign() > p.sign();
  48. }
  49. return (*this * p) > 0;
  50. }
  51. }p[100100], b[100100];
  52.  
  53. int main() {
  54. #ifdef LOCAL
  55. freopen("in", "r", stdin);
  56. freopen("out", "w", stdout);
  57. #endif
  58. cin >> n >> A >> B;
  59. for(int i = 0; i < n; ++i){
  60. p[i].read();
  61. }
  62. for(int i = 0; i < n; ++i){
  63. for(int j = i + 1; j < n; ++j){
  64. for(int k = j + 1; k < n; ++k){
  65. if(((p[i] -p[k]) % (p[j] - p[k]) == 0)){
  66. ll cur = abs((p[i] - p[k]) * (p[j] - p[k]));
  67. if(cur >= 2 * A && cur <= 2 * B){ ans++;
  68. //cerr << p[k].x << " " << p[k].y << " " << p[i].x << " " << p[i].y << " " << p[j].x << " " << p[j].y << endl;
  69. }
  70. }
  71. if(((p[i] - p[j]) % (p[k] - p[j]) == 0)){
  72. ll cur = abs((p[i] - p[j]) * (p[k] - p[j]));
  73. if(cur >= 2 * A && cur <= 2 * B){ ans++;
  74. //cerr << p[j].x << " " << p[j].y << " " << p[i].x << " " << p[i].y << " " << p[k].x << " " << p[k].y << endl;
  75. }
  76. }
  77. if(((p[k] - p[i]) % (p[j] - p[i]) == 0)){
  78. ll cur = abs((p[k] - p[i]) * (p[j] - p[i]));
  79. if(cur >= 2 * A && cur <= 2 * B) {ans++;
  80. //cerr << p[i].x << " " << p[i].y << " " << p[j].x << " " << p[j].y << " " << p[k].x << " " << p[k].y << endl;
  81. }
  82. }
  83. }
  84. }
  85. }
  86. cout << ans << endl;
  87. /*for(int i = 0; i < n; ++i){
  88. int cnt = 0;
  89. for(int j = 0; j < n; ++j){
  90. if(i == j) continue;
  91. b[cnt] = p[j] - p[i];
  92. cnt++;
  93. }
  94. sort(b, b + cnt);
  95. /*int r = 0;
  96. for(int l = 0; l < cnt; ++l){
  97. r = max(r , l);
  98. //cout << b[l] % b[(r + l) % cnt] << endl;
  99. while(r < cnt && b[l] % b[(r + l) % cnt] == 0){
  100. ll area = abs(b[l] * b[(r + l) % cnt]);
  101. if(area >= 2 * A && area <= 2 * B){
  102. ans++;
  103. }
  104. r++;
  105. }
  106. r--;
  107. }
  108. int r = 1;
  109. /*
  110. for(int l = 0; l < cnt; ++l)
  111. {
  112. r = max(r, l + 1);
  113. while(r < cnt && b[l] % b[r] != 0)
  114. ++r;
  115. int t = r;
  116. while(t < cnt && b[l] % b[t] == 0)
  117. {
  118. ll area = abs(b[l] * b[t]);
  119. if(area >= 2 * A && area <= 2 * B)
  120. ++ans;
  121. ++t;
  122. }
  123. }
  124.  
  125. for(int j = 0; j < cnt; ++j){
  126. for(int k = j + 1; k < cnt; ++k){
  127. if(b[j] % b[k] == 0){
  128. ll area = abs(b[j] * b[k]);
  129. if(area >= 2 * A && area <= 2 * B){
  130. // 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;
  131. // cerr<<"! "<<b[j].x<<' '<<b[j].y<<' '<<b[k].x<<' '<<b[k].y<<endl;
  132. cerr<<i<<' '<<j<<' '<<k<<' '<<b[j]%b[k]<<endl;
  133. ans++;
  134. }
  135. }
  136. }
  137. }
  138. }*/
  139. #ifdef LOCAL
  140. cerr << endl << clock() * 1000 / CLOCKS_PER_SEC << " ms.\n";
  141. #endif
  142. return 0;
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement