#26106: 純排序


p500297@gmail.com (06)

School : 國立中正大學
ID : 124721
IP address : [36.232.165.22]
Last Login :
2021-09-19 00:24:51
b604. Center of Symmetry | From: [114.41.85.205] | Post Date : 2021-07-16 20:06

依X Y大小排序即可>>去檢查左右的點相加是否一樣,就可以不用開DOUBLE

>>EX: A1,A2,A3,A4,A5,A6,A7,A8---sort---->check A1.x+A8.x=A2.x+A7.x=A3.x+A6.x=A4.x+A5.x(y一樣)

struct node{

int x,y;

};

bool cmp(node a,node b){

if(a.x!=b.x)return a.x>b.x;

return a.y>b.y;

}

 
ZeroJudge Forum