Gravatar
Satoshi
积分:2996
提交:678 / 1922
回复 @stone :
M是什么,你们写的是DP吗?

Gravatar
stone
积分:1531
提交:406 / 764
回复 @Satoshi :
O(NM),本来时限是0.5s的

Gravatar
Satoshi
积分:2996
提交:678 / 1922
回复 @溪哥 :
你们是怎么写的?貌似看着是O(n^2)

Gravatar
zys
积分:1679
提交:471 / 964
回复 @Satoshi :

Gravatar
Satoshi
积分:2996
提交:678 / 1922
作者请加数据范围

Gravatar
神利·代目
积分:3115
提交:802 / 1626
同样是n^3的做法,为什么差别这么大?

Gravatar
Satoshi
积分:2996
提交:678 / 1922
证明:
Sort the haybales by location. Consider two haybales i and j such that Bessie can start somewhere between those haybales and break through all the haybales from i+1 to j−1, but she can't break haybale i or haybale j.
It must be the case then that no haybale between i and j is strictly taller than those two.
That motivates the following O(NlogN)solution:
Sort the haybales in decreasing order of size. Consider having an empty road, and place the haybales in that order. When placing a haybale, look immediately to its left and to its right and see if you can break through either one of those haybales if you were inside that interval. Mark that interval as "trapped" if so.
This will be O(NlogN)
as long as you check to make sure that the interval isn't already marked as trapped.
按重量从大到小排序,可以保证区间不会被漏掉

Gravatar
mikumikumi
积分:4118
提交:830 / 1893
莫比乌斯反演的裸题。。

Gravatar
asddddd
积分:614
提交:109 / 351
我竟然把sv设成0了。。。都可以去卖萌了QAQ

Gravatar
stdafx.h
积分:3332
提交:889 / 1556
这个题竟然半颗星....

题目 1389 number-b
2016-04-05 14:54:17
Gravatar
stdafx.h
积分:3332
提交:889 / 1556
最后一句话亮了...话说让他切题的那个人做我右面的右面的左面

Gravatar
葳棠殇
积分:1417
提交:362 / 782
最后一句话亮了...话说让他切题的那个人做我右面的右面

Gravatar
stone
积分:1531
提交:406 / 764
貌似如果数据是一个标准的矩形,就会被卡掉。。。。。 $\sum poet$

Gravatar
铁策
积分:988
提交:301 / 737
%%%%%%
妈蛋银组题都那么丧(wu)病(liao)。。。
我是不是弱的没救了呢

Gravatar
assassain
积分:1068
提交:233 / 619
最后一句话亮了。。。。。。

Gravatar
0
积分:2001
提交:530 / 1238
最后一句话亮了。。。。。。

Gravatar
stdafx.h
积分:3332
提交:889 / 1556
最后一句话亮了。。。。。。

Gravatar
神利·代目
积分:3115
提交:802 / 1626
最后一句话亮了。。。。。。

Gravatar
1azyReaper
积分:774
提交:185 / 380
强占一楼

Gravatar
Satoshi
积分:2996
提交:678 / 1922
回复 @葳棠殇 :
CF某题跟这个一样吗?