poj3928 ping pong(水题)

这是一篇关于如何利用树状数组高效解决寻找ping pong比赛裁判问题的文章。博主首先介绍了原题背景,然后分别阐述了暴力枚举的算法(时间复杂度过高)和树状数组优化后的算法,其中树状数组用于快速查询和更新。在算法二中,博主解释了如何通过l_up, l_low, r_up, r_low数组来计算裁判的贡献,并处理了相乘可能溢出的情况。文章还探讨了当整数不互异时,原有算法为何会出错,并提出了解决重复计算的方法。" 110971307,10296982,自动输入密码技术在脚本和系统登录中的应用,"['Linux', 'shell脚本', 'Windows', '密码管理', '自动登录']
摘要由CSDN通过智能技术生成

原题传送门

题面

Description
N(3<=N<=20000) ping pong players live along a west-east street(consider the street as a line segment). Each player has a unique skill rank. To improve their skill rank, they often compete with each other. If two players want to compete, they must choose a referee among other ping pong players and hold the game in the referee’s house. For some reason, the contestants can’t choose a referee whose skill rank is higher or lower than both of theirs. The contestants have to walk to the referee’s house, and because they are lazy, they want to make their total walking distance no more than the distance between their houses. Of course all players live in different houses and the position of their houses are all different. If the referee or any of the two contestants is different, we call two games different. Now is the problem: how many different games can be held in this ping pong street?

大致题意:
给定n个互异整数 a[1]a[n] a [ 1 ] − a [ n ] ,求 ni=1<

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值