luogu|luogu 5471 [NOI2019]弹跳 KDtree + Dijkstra

Code:

#include #define setIO(s) freopen(s".in","r",stdin) #define maxn 2000000 #define inf 100000000 #define lson t[now].ch[0] #define rson t[now].ch[1] #define ll long long using namespace std; struct Edge { int t,x1,y1,x2,y2; Edge(int t=0,int x1=0,int y1=0,int x2=0,int y2=0):t(t),x1(x1),y1(y1),x2(x2),y2(y2){} }; struct Data { int ch[2],minv[2],maxv[2],siz,id,p[2]; }t[maxn],arr[maxn]; struct P { int dis,id; P(int dis=0,int id=0):dis(dis),id(id) {} bool operator<(P b) const { return b.disG[maxn]; priority_queueQ; vectoredges; int d,cnt,len; int dis[maxn],answer[maxn],nd[maxn],vis[maxn]; void Min(int &a,int b) { if(ba) a=b; } bool cmp(Data i,Data j) { return i.p[d]==j.p[d]?i.p[d^1]>1; d=o,nth_element(arr+l,arr+mid,arr+1+r,cmp); build(l,mid,lson,o^1); if(r>mid) build(mid+1,r,rson,o^1); pushup(now),t[now].siz=t[lson].siz+t[rson].siz; } void dfs(int now,int x1,int y1,int x2,int y2) { if(t[now].minv[0]>y1||t[now].maxv[0]y2||t[now].maxv[1]

【luogu|luogu 5471 [NOI2019]弹跳 KDtree + Dijkstra】

    推荐阅读