81分求调
查看原帖
81分求调
585011
__AlRTy__楼主2022/11/25 08:34

submition

#include<map>
#include<cstdio>
#include<string>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
        x=x*10+ch-'0',ch=getchar();
    return x*f;
}
const int N=2e4+10;
struct Node{
    double x,y;
    friend bool operator < (Node x,Node y){
        if(x.x==y.x){
            return x.y>y.y;
        }
        return x.y>y.y;
    }
}a[N];
struct Pair{
    double f,s;
};
int n;
vector<Pair> v;
map<Pair,int> m;
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);
    double mx,my,lastx,lasty;
    for(int i=1,j=n;i<=j;i++,j--){
        double tx=abs(a[i].x-a[j].x)/2,ty=abs(a[i].y-a[j].y)/2;
        mx=max(a[i].x,a[j].x)-tx,my=max(a[i].y,a[j].y)-ty;
        if((mx!=lastx || my!=lasty) && i!=1){
            puts("This is a dangerous situation!"); 
            return 0;
        }else{
            lastx=mx;
            lasty=my;
        }
        // cout<<lastx<<"ll"<<lasty;
    }
    printf("V.I.P. should stay at (%.1lf,%.1lf).",mx,my);
    return 0;
}
2022/11/25 08:34
加载中...