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 通用账户