Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <string>
- #include <map>
- #include <set>
- #include <algorithm>
- #include <vector>
- #include <stdio.h>
- #include <cmath>
- #include <math.h>
- #include <queue>
- #include <stack>
- #include <climits>
- #include <deque>
- #include <ctime>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef unsigned int ui;
- #define mh() make_heap()
- #define poph() pop_heap()
- #define pushh() push_heap()
- #define sor(n) n.begin(), n.end()
- #define mp make_pair
- #define files freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout)
- #define p(T) pair<T,T>
- #define formx(a1,b1,c1,a2,b2,c2) ((a1*c2-a2*c1)/(a1*b2-b1*a2))
- #define formy(a1,b1,c1,a2,b2,c2) ((c1*b2-c2*b1)/(a1*b2-b1*a2))
- #define forma(y1,y2) (y2-y1)
- #define formb(x1,x2) (x1-x2)
- #define formc(x1,y1,x2,y2) (x1*(y2-y1)-y1*(x2-x1))
- #define ras(x1,y1,x2,y2) sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))
- struct cord
- {
- double x1, y1, x2, y2;
- };
- struct limcord
- {
- double x, y;
- bool good;
- };
- bool checkparal(double a1, double a2, double b1, double b2)
- {
- return a1 / b1 == a2 / b2;
- }
- limcord findt(cord c, cord now)
- {
- double a1 = forma(now.y1, now.y2);
- double b1 = formb(now.x1, now.x2);
- double c1 = formc(now.x1, now.y1, now.x2, now.y2);
- double a2 = forma(c.y1, c.y2);
- double b2 = formb(c.x1, c.x2);
- double c2 = formc(c.x1, c.y1, c.x2, c.y2);
- if (!checkparal(a1, a2, b1, b2))
- {
- double x = formx(a1, b1, c1, a2, b2, c2);
- double y = formy(a1, b1, c1, a2, b2, c2);
- return{ x,y, true };
- }
- else
- {
- return{ NULL,NULL, false };
- }
- }
- bool checkT(limcord now, cord ot)
- {
- if (ras(ot.x1, ot.y1, ot.x2, ot.y2) == ras(ot.x1, ot.y1, now.x, now.y) + ras(ot.x2, ot.y2, now.x, now.y))
- return true;
- else
- return false;
- }
- vector <ll> fib;
- void aadfib()
- {
- fib.push_back(1);
- fib.push_back(1);
- for (int i = 3; i <= 1e7; i++)
- {
- fib.push_back(fib[i - 1] + fib[i - 2]);
- }
- }
- #define formk(x1,x2,y1,y2) (y1 - y2) / (x1 - x2)
- #define formbk(k,x2,y2) y2 - k * x2
- int gcd(int a, int b)
- {
- while (b)
- {
- a %= b;
- swap(a, b);
- }
- return a;
- }
- int main()
- {
- files;
- map <p(double), int>cordm;
- ll n;
- int x, y;
- cin >> n;
- vector <p(int)>cords;
- for (int i = 1; i <= n; i++)
- {
- cin >> x >> y;
- cords.push_back(mp(x, y));
- }
- int ms = 0;
- int maxs;
- for (int i = 0; i < n; i++)
- {
- x = 0;
- maxs = 0;
- for (int j = i+1; j < n; j++)
- {
- if (cords[i].first == cords[j].first)
- {
- x++;
- }
- else
- {
- int k = cords[j].second - cords[i].second;
- int b = cords[j].first - cords[i].first;
- int g = gcd(k, b);
- b /= g;
- k /= g;
- cordm[mp(k, b)]++;
- maxs = max(maxs,cordm[mp(k, b)]);
- }
- maxs = max(maxs, x);
- }
- ms = max(maxs + 1, ms);
- cordm.clear();
- }
- cout << ms;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment