Pagini recente » Cod sursa (job #3276665) | Cod sursa (job #3236485) | Cod sursa (job #2246703) | Cod sursa (job #3273441) | Cod sursa (job #3146754)
#include<bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define N 240001
#define p pair<double,double>
int i,j,M,t;
p v[N],h[N];
bool d(p &a,p &b,p &c)
{
return (a.x-c.x)*(b.y-c.y)-(a.y-c.y)*(b.x-c.x)<0;
}
int main()
{
freopen("infasuratoare.in","r",stdin),freopen("infasuratoare.out","w",stdout),scanf("%d",&M);
for(i=0;i<M;++i)
scanf("%lf%lf",&v[i].x,&v[i].y);
sort(v,v+M),reverse_copy(v,v+M-1,v+M);
for(i=0;i<2*M-1;h[j++]=v[i++])
while(j>1&&d(h[j-2],h[j-1],v[i]))
--j;
printf("%d\n",--j);
for(i=0;i<j;++i)
printf("%.9lf %.9lf\n",h[i].x,h[i].y);
return 0;
}