5-SUM
CodeChefOpen on judge ↗
You are given 5 arrays: $A$ $B$ $C$ $D$ $E$ each of size $N$. Let $P(S)$ be the probability that $S = A[u] + B[v] + C[w] + D[x] + E[y]$ for all $1 \leq u, v, w, x, y \leq N$ You are given $Q$ different queries each with some $S$: - You need to find the corresponding probability $P(S)$ under modulo $998244353$ Probability $X / Y$ can be expressed as $X * Y^{-1}$ modulo 998244353 wher
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start