| ||||||||||
| 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 | |||||||||
Kruskal C++TLE G++ 300ms+ 水过 分享几点优化1.不用计算距离 , 即 不用sqrt() 因为这道题没有要求算距离
2.建边时for(i,0,n){ for(j,i+1,n){...}}
3.已有的边直接把它们用并查集并到一块 不用什么把它们距离设为0在加进去
但是我不知道为什么C++ 会TLE,向大神们请教下为什么?
代码:http://fayaa.com/code/view/27227/
ps:我不是贴代码,我是想知道为什么C++会TLE...
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator