We revisit the 3SUM problem in the \emph{preprocessed universes} setting. We present an algorithm that, given three sets $A$, $B$, $C$ of $n$ integers, preprocesses them in quadratic time, so that given any subsets $A' \subseteq A$, $B' \subseteq B$, $C' \subseteq C$, it can decide if there exist $a \in A'$, $b \in B'$, $c \in C'$ with $a+b=c$ in time $O(n^{1.5} \log n)$. In contrast to both the first subquadratic $\tilde{O}(n^{13/7})$-time algorithm by Chan and Lewenstein (STOC 2015) and the current fastest $\tilde{O}(n^{11/6})$-time algorithm by Chan, Vassilevska Williams, and Xu (STOC 2023), which are based on the Balog--Szemer\'edi--Gowers theorem from additive combinatorics, our algorithm uses only standard 3SUM-related techniques, namely FFT and linear hashing modulo a prime. It is therefore not only faster but also simpler. Just as the two previous algorithms, ours not only decides if there is a single 3SUM solution but it actually determines for each $c \in C'$ if there is a solution containing it. We also modify the algorithm to still work in the scenario where the set $C$ is unknown at the time of preprocessing. Finally, even though the simplest version of our algorithm is randomized, we show how to make it deterministic losing only polylogarithmic factors in the running time.
翻译:我们重新审视了在\emph{预处理宇宙}设定下的3SUM问题。我们提出一种算法,给定三个包含$n$个整数的集合$A$、$B$、$C$,能够在平方时间内对它们进行预处理,使得对于任意子集$A' \subseteq A$、$B' \subseteq B$、$C' \subseteq C$,该算法可在$O(n^{1.5} \log n)$时间内判定是否存在$a \in A'$、$b \in B'$、$c \in C'$满足$a+b=c$。相较于Chan与Lewenstein(STOC 2015)提出的首个亚二次$\tilde{O}(n^{13/7})$时间算法,以及Chan、Vassilevska Williams和Xu(STOC 2023)提出的当前最快$\tilde{O}(n^{11/6})$时间算法(两者均基于加法组合学中的Balog--Szemer\'edi--Gowers定理),我们的算法仅使用标准的3SUM相关技术,即快速傅里叶变换(FFT)与模素数线性哈希。因此,该算法不仅速度更快,而且更为简洁。与前述两种算法相同,我们的算法不仅能判定是否存在单个3SUM解,还能针对每个$c \in C'$确定是否存在包含该元素的解。我们还对算法进行了修改,使其在预处理阶段未知集合$C$的情况下仍能正常工作。最后,尽管我们算法的最简版本是随机化的,我们展示了如何通过仅增加运行时间中的多对数因子代价,将其转化为确定性算法。