``````__gcd(0, 0)=0
__gcd(0, a)=a	//a可正可负。
__gcd(a, b)     //结果与b的符号相同
``````
``````排序的时候用a[1]*b[2]>a[2]*b[1]错了。

``````
``````还要特判a[i]==0&&b[i]==0和a[i]==0&&b[i]!=0

``````
``````统计的时候只能用:
map<pair<int, int>, int> p;
p[{a[i], b[i]}]++;

map<int, int> p[maxn];
p[a[i]][b[i]]++;
``````
``````#include<bits/stdc++.h>
#define LL long long
#define p1 first
#define p2 second
using namespace std;
const int mod=1e9+7;
//memset(a, 0, sizeof(a));
//stack堆栈 queue队列 priority_queue优先队列
//vector向量 multiset平衡二叉树 deque双端队列
//pair{T1 first;T2 second;} greater<T>
//unordered_map 哈希map

int a[200005];
int b[200005];
map<pair<int, int>, int > p;

int main()
{
int n, u=0;
scanf("%d",&n);
for(int i=0; i<n; i++)
{
scanf("%lld",&a[i]);
}
for(int i=0; i<n; i++)
{
scanf("%lld",&b[i]);
}
for(int i=0; i<n; i++)
{
if(a[i]==0&&b[i]==0)
{
u++;
}
else if(a[i]==0)
{

}
else
{
LL g=__gcd(a[i], b[i]);
a[i]/=g, b[i]/=g;
p[{a[i], b[i]}]++;
}
}
int MAX=0;
for(map<pair<int, int>, int >::iterator i=p.begin();i!=p.end();i++)
{
MAX=max(int(i->p2), MAX);
}
cout<<MAX+u<<endl;

return 0;
}
``````