[Bzoj1597][Usaco 2008 Mar] 토지 매입

#include
#include
#include
using namespace std;
struct data{
    int x,y;
}a[50005];
int q[50005],l,r,tot,n;
long long x[50005],y[50005],f[50005];
inline bool cmp(data a,data b){
    return a.x==b.x?a.y'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return f*x;
}
inline double calc(int k,int j){
    return (double)(f[j]-f[k])/(y[k+1]-y[j+1]);
}
int main(){
    n=read();
    for(int i=1;i<=n;i++){
        a[i].x=read();a[i].y=read();
    }
    sort(a+1,a+n+1,cmp);
    for(int i=1;i<=n;i++){
        while(tot&&a[i].y>=y[tot])tot--;
        x[++tot]=a[i].x;y[tot]=a[i].y;
    }
    for(int i=1;i<=tot;i++){
        while(l

좋은 웹페이지 즐겨찾기