这是我之前写的一篇博客
https://blog.nowcoder.net/n/f9141f797de94001b5507265ae6f2aa3
下面附上正确代码

#include<bits/stdc++.h>
using namespace std;
typedef long long LL; 
typedef pair< int,pair<int ,int > > judge;
map< judge,vector<pair <LL , int> > > array1;
int N;
LL res=0;
int ans=0;

int typefunction(int x,int y){
   
    if(x>0&&y>=0) return 0;
	if(x<=0&&y>0) return 1;
	if(x<0&&y<=0) return 2;
	if(x>=0&&y<0) return 3;
}
void kfunction(LL &m,LL &n){
    ///化成最小的约数 
	LL m0 = m, n0 = n;    //m0和n0保存m和n的原始值
	while (m%n != 0) {
   
		LL temp = m ;
		m = n;
		n = temp%n;
	}
	m=m0/n;
	n=n0/n;
	return ;
}
int main(){
   
   scanf("%d",&N);
   for(int i=0;i<N;++i)
   {
   
   	    LL x,y ;int p;
   	    scanf("%lld%lld%d",&x,&y,&p);
   	    res+=p;
		       int index=typefunction(x,y);
		       x=abs(x),y=abs(y);
		       if(x==0){
   
		       	pair<int,int> num1(0,1);
		       	judge NUM(index,num1);
		       	array1[NUM].push_back({
   y,p}); 
			   }
			   else if(y==0){
   
			   	pair<int,int> num1(1,0);
		       	judge NUM(index,num1);
		       	array1[NUM].push_back({
   x,p}); 
			   }
		       else{
   
		       	LL d=x*x+y*y;
		       	kfunction(x,y);
		       	pair<int,int> num1(x,y);
		       	judge NUM(index,num1);
		       	array1[NUM].push_back({
   d,p}); 
			   }
	}
	for(auto x : array1){
   
		vector<pair<LL, int>> vec = x.second;
		sort(vec.begin(),vec.end());
		for(int i=0;i<vec.size();++i){
   
			if(vec[i].second!=1){
   
				ans++;
			}
		    else if((vec[i+1].second!=1&&vec.size()>i+1)||i+1==vec.size()){
   
		    	ans++;
			}
		}
	}
	printf("%d %d",res,ans);    
	return 0;   	
}