#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>PII;
typedef long long ll;
int n;
map<PII,vector<pair<ll,int>>>mp;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
int score = 0;
int step = 0;
for(int i = 0;i<n;i++) {
ll x, y;
int s;
cin >> x >> y >> s;
score += s;
ll d = x*x + y*y;
ll w = abs(__gcd(x,y));
x/=w,y/=w;
mp[{x,y}].push_back({d,s});
}
for(auto it:mp){
vector<pair<ll,int>> v = it.second;
sort(v.begin(),v.end());
int s = v.size();
for(int i = 0;i<s;i++){
if(v[i].second!=1) step++;
else{
if((i+1<s&&v[i+1].second!=1)||i+1==s)step++;
}
}
}
cout<<score<<' '<<step;
return 0;
}
有一说一,这题数据有点强,连x和y都得开long long,调试了好久