Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这题...我无语...原来以为是二分,没想到二分的自己老调不过,后来只能用HASH咯,没想到竟然只有79MS... 数据太弱了 设置一个HASH数组表示但前剩下的每个长度的个数,因为l<=10000所以远比o(n2)的算法好。 每次如果hash[a[i]]>0就ans++;然后扫l-a[i],刚开始赋值hash[0]:=500000 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator