A. Extra-terrestrial IntelligenceThis task is very easy, and I hope all of you have solved it. But let's talk about it.
Let input sequence is named as a, and its length is n. Then let's save sequence x1, ..., xk is increasing order - all of positions, where axi = '1'.
We must check if this sequence x1, ..., xk is a arithmetic progression. We save variable d = x2 - x1 and check:
for all 1 ≤ i < k, is "d = xi + 1 - xi" correct.
If it's correct, output "YES", else "NO".