Given array a of length n. Consider triples [a_j, a_{j+1}, a_{j+2}] for 1 <= j <= n-2. Count pairs of triples differing in exactly one of the three positions. Constraints: 1 <= t <= 10^4, 3 <= n <= 210^5, 1 <= a_i <= 10^6, sum(n) <= 210^5.
註冊一個 Cairn 通用賬戶,您就可以在我們提供的所有線上評測服務上提交程式碼、參與討論。
使用您的 Cairn 通用賬戶