We propose the functions defined by the maximum of a discrete quadratic form and satisfying the ultradiscrete KdV equation. These functions includes not only soliton solutions but also pseudo-periodic solutions. In the proof, we employ some facts of discrete convex analysis.