Pagini recente » Cod sursa (job #381617) | Istoria paginii runda/hc_round1/clasament | Istoria paginii utilizator/ana_maria.milcu | Istoria paginii runda/hc_round4 | Cod sursa (job #1597540)
#include <bits/stdc++.h>
#define x first
#define y second
#define N 240001
#define p pair<double,double>
using namespace std;
string a="infasuratoare.";
ifstream f(a+"in");
ofstream g(a+"out");
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(){
f>>M;
for(i=0;i<M;++i)f>>v[i].x>>v[i].y;
sort(v,v+M);reverse_copy (v,v+M,v+M);
for(i=0;i<2*M;h[j++]=v[i++])
while(j>1 && d(h[j-2],h[j-1],v[i]))--j;
g<<j<<'\n';
for(i=0;i<j;++i)g<<h[i].x<<" "<<h[i].y<<'\n';
return 0;
}