o(n²×log₂(n²)×a(n))为什么会超时

P2212 [USACO14MAR] Watering the Fields S

吓得一匹,是const
by 翰森锐 @ 2019-10-05 23:49:00


@[i_am_aking_ioi](/space/show?uid=87799) 说,`(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])` 这个算两遍干嘛,常数能不大吗(
by StudyingFather @ 2019-10-05 23:51:32


拿一个中间变量存一下应该就过了吧。
by StudyingFather @ 2019-10-05 23:51:50


干嘛用longlong 换成int就行吧
by 帽子 @ 2019-10-05 23:52:34


@[StudyingFather](/space/show?uid=22030) 谢谢巨佬,改了再加个o2就通过了。 不过为什么不加o2还是通过不了啊。
by xh39 @ 2019-10-05 23:53:50


@[i_am_aking_ioi](/space/show?uid=87799) 还有,内层循环从 i+1 开始,可以少建一半的边,相应减少一半计算量![/cy](https://cdn.luogu.com.cn/upload/pic/62225.png)
by StudyingFather @ 2019-10-05 23:54:24


2000用n方logn本来就不稳,这题有n方解法
by lcyxds @ 2020-09-20 10:28:02


@[lcyxds](/user/124314) 千万级别了
by lcyxds @ 2020-09-20 10:28:47


|