Counting Triples
For original problem statement, pls refer to the source image down below 👇
Once upon a time, in a land where numbers roamed free, there existed a magical array that could contain as many integers as it desired. The array was curious and ever-changing, for it was governed by a series of mystical commands known as queries.
Our story begins with the array starting off completely empty, a blank slate awaiting adventure. The queries came in two forms:
After each spell was cast, the array would ponder upon the number of magical triples (x, y, z) within itself. These triples had to meet a special condition: the difference between 𝑥 and 𝑦 had to be the same as the difference between 𝑦 and 𝑧. This special difference was known as "diff."
The array, being wise and meticulous, would count these triples after each query and keep track of the counts.
In our tale, it is important to note that:
Thus, the array embarked on its journey, processing each query and recounting its magical triples, sharing the results as it went along.
𖤣𖥧𖡼𓋼𖤣𖥧𓋼 🌱 Credit to ʚrobotɞ 🌱 𖤣𖥧𖡼𓋼𖤣𖥧𓋼ଓ༉