hdu 3627 Giant For 离散化+线段树 在一个二维平面内任意的添加一个点和删除一个点,然后来寻找一个横纵坐标都比已经添加的点大的点,首先选择横坐标最小的,其次是纵坐标最小的

这篇博客介绍了一个在二维平面上进行点添加和删除的问题,利用离散化和线段树数据结构,高效地找到横纵坐标都大于已添加点的最小坐标。首先按横坐标选择最小的点,其次按纵坐标选择最小的点。博客中给出了详细的算法实现,包括build_tree、modify和query等函数。
摘要由CSDN通过智能技术生成
Problem Description
It is known to us all that YY and LMY are mathematics lovers. They like to find and solve interesting mathematic problems together. Now LMY designs a game for matrix. There is a large matrix whose rows and columns are both not more than 1000000000. And there are three operations for the matrix:
1) add: Mark an element in the matrix. It is guaranteed that the element has not been marked before.
2) remove: Delete an element’s mark. It is guaranteed that the element has been marked before.
3) find: For a given element’s row and column, return a marked element’s row and column, where the marked element’s row and column are larger than the given element’s row and column respectively. If there are multiple solutions, return the element whose row is the smallest; and if there are still multiple solutions, return the element whose column is the smallest. If there is no solution, return -1.
LMY lets YY develop a program to solve the problem. Could you also develop a program to solve the problem?
 


 

Input
The input consists of multiple test cases. For each test case, the first line contains only one integer n. n ≤ 200000. Each of the next n lines descri
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值