Advertisement
Guest User

Untitled

a guest
Jan 21st, 2012
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.59 KB | None | 0 0
  1. // Solution by Aytbayev Sherzat
  2. #pragma comment(linker, "/STACK:64000000")
  3. #define _CRT_NO_WARNINGS
  4.  
  5. #include<iostream>
  6. #include<fstream>
  7. #include<ctime>
  8. #include<algorithm>
  9. #include<map>
  10. #include<ctime>
  11. #include<cstdio>
  12. #include<string>
  13. #include<math.h>
  14. #include<vector>
  15. #include<set>
  16. #include<deque>
  17. #include<cstdlib>
  18. #include<utility>
  19. #define abs(x) ((x) < 0 ? -(x) : (x))
  20. #define mp make_pair
  21. #define PI pair<int, int>
  22. #define VI vector <int>
  23. #define VB vector <bool>
  24. #define FOR(i, n) for(int (i) = 0; (i) < (n); (i)++)
  25. #define VP vector <PI>
  26. #define INF 1 << 30
  27. #define pb push_back
  28. #define ll long long
  29. #define fi first
  30. #define se second
  31. #define debug cerr << "a ";
  32. using namespace std;
  33. int n, x[2010], y[2010];
  34. map < pair < pair <ll, ll>, ll>, set <int> > m;
  35. //map < pair < pair <long long, int>, int>, set <int> > m;
  36. int main(){
  37. //  #ifndef ONLINE_JUDGE
  38.         freopen("input.txt", "r", stdin);
  39.         freopen("output.txt", "w", stdout);
  40. //  #endif
  41.                            
  42.     cin >> n;
  43.  
  44.     for(int i = 0; i < n; ++i)             
  45.         cin >> x[i] >> y[i];
  46.  
  47.     for(int i = 0; i < n; ++i)
  48.         for(int j = 0; j < n; ++j)
  49.             if(i != j){
  50.                 ll A, B, C;
  51.                 A = 1LL * y[j] - 1LL * y[i];
  52.                 B = 1LL * x[i] - 1LL * x[j];
  53.                 C = -(1LL * A * x[j] + 1LL * B * y[j]);
  54.  
  55.                 m[mp(mp(A, B), C)].insert(i);
  56.                 m[mp(mp(A, B), C)].insert(j);
  57.             }
  58.  
  59.     int mx = 1;
  60.  
  61.     for(map < pair < pair <ll, ll>, ll>, set <int> > :: iterator it = m.begin(); it != m.end(); it++){
  62.         set <int> q = it->se;
  63.         mx = max(mx, (int)q.size());
  64.     }
  65.  
  66.     cout << mx;
  67.                  
  68.         return 0;      
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement