专栏文章

Solution of AT_tenka1_2018_e Equilateral

AT_tenka1_2018_e题解参与者 1已保存评论 0

文章操作

快速查看文章及其快照的属性,并进行相关操作。

当前评论
0 条
当前快照
1 份
快照标识符
@miqyaygq
此快照首次捕获于
2025/12/04 12:43
3 个月前
此快照最后确认于
2025/12/04 12:43
3 个月前
查看原文
你可以浏览这个题解的中文版本
The images are hosted on Github, use an accelerator if it fails to load.
Consider drawing the Huffman distance of three points.
Then we have a+b+c=a+b+d=c+da+b+c=a+b+d=c+d, i.e. a+b=c=da+b=c=d. This means that the slope of BC\overline{BC} is ±1\pm1 and AA is on a line parallel to it.
We might as well O(n2)\mathcal{O}(n^2) enumerate BB, O(n)\mathcal{O}(n) enumerate CC, and compute the number of legal AA by difference O(1)\mathcal{O}(1). Complexity O(n3)\mathcal{O}(n^3) with large constants.
Specifically, we enumerate (i,j)(i,j) and k<ik<i, and the problem translates into finding the number of ax,y=1a_{x,y}=1 on the four lines. It is sufficient to preprocess the prefix sum for each line with slope ±1\pm1.
Note that to avoid double counting , it may be worthwhile to count the special endpoint positions separately.

评论

0 条评论,欢迎与作者交流。

正在加载评论...