//\\__ hr1212 __//\\
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%lf %lf",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 1000100
#define MOD 1000000007
int n,m;
map<pair<double,double>,int> mm;
map<pair<double,double>,int>::iterator it;
vector<pair<double,double> > v;
double slope(int x,int y){
if((v[y].second-v[x].second)==0)
return 1e9;
return (v[y].first-v[x].first)/(v[y].second-v[x].second);
}
int main(){
int r,k,i,c=1,j,t,l,z,x1=0,y1=0;
ll ans=0;string p;
double x,y;
si(t);
while(t--){
mm.clear();
v.clear();
si(n);
f(i,0,n){
sii(x,y);
mm[mp(x,y)]++;
}
z=mm.size();
for(it=mm.begin();it!=mm.end();it++){
v.pb(mp(it->first.second,it->first.first));
}
n=v.size();
r=0;
f(i,0,n){
f(j,i+1,n){
l=2;
f(k,j+1,n){
if(slope(i,j)==slope(j,k))
l++;
}
r=max(r,l);
}
}
if(z!=1)
printf("Data set #%d contains %d gnus, out of which a maximum of %d are aligned.",c++,z,r);
else
printf("Data set #%d contains a single gnu.",c++);
nl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%lf %lf",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 1000100
#define MOD 1000000007
int n,m;
map<pair<double,double>,int> mm;
map<pair<double,double>,int>::iterator it;
vector<pair<double,double> > v;
double slope(int x,int y){
if((v[y].second-v[x].second)==0)
return 1e9;
return (v[y].first-v[x].first)/(v[y].second-v[x].second);
}
int main(){
int r,k,i,c=1,j,t,l,z,x1=0,y1=0;
ll ans=0;string p;
double x,y;
si(t);
while(t--){
mm.clear();
v.clear();
si(n);
f(i,0,n){
sii(x,y);
mm[mp(x,y)]++;
}
z=mm.size();
for(it=mm.begin();it!=mm.end();it++){
v.pb(mp(it->first.second,it->first.first));
}
n=v.size();
r=0;
f(i,0,n){
f(j,i+1,n){
l=2;
f(k,j+1,n){
if(slope(i,j)==slope(j,k))
l++;
}
r=max(r,l);
}
}
if(z!=1)
printf("Data set #%d contains %d gnus, out of which a maximum of %d are aligned.",c++,z,r);
else
printf("Data set #%d contains a single gnu.",c++);
nl;
}
return 0;
}
No comments:
Post a Comment