A. Do Not Be Distracted!
Solution:
Scan the string. When we found a new letter, we skip the continually same letter. And mark this letter should not present again. If it presents again, then output "NO".
Code:
![](http://codeforces.org/s/94231/images/codeforces-telegram-square.png)
B. Ordinary Numbers
Solution:
Construct beautiful numbers within 9 digits from 1-9. Count the number if it less than n.
Code:
![](http://codeforces.org/s/94231/images/codeforces-telegram-square.png)
C. Not Adjacent Matrix
Solution:
Fill in the numbers along the diagonal. Take $ n = 5 $ as an example:
![](https://zh.xloypaypa.pub/content/images/2021/05/image-3.png)
Code:
![](http://codeforces.org/s/94231/images/codeforces-telegram-square.png)
D. Same Differences
Solution:
Transform the equation, then we get $a_j - j = a_i - i$. So, scan the array, count the number of every $a_x - x$. And calculate the sum of $C_n^2$.
Code:
![](http://codeforces.org/s/94231/images/codeforces-telegram-square.png)
E. Arranging The Sheep
In fact, it depends on how many sheep go to the left and how many sheep go to the right.
![](http://codeforces.org/s/91713/android-icon-192x192.png)
F. Guess the K-th Zero (Easy/Hard Version)
Binary search. Query the range $[1,mid]$. But it will change the number in hard version. And we need plus one for some of our caches. So, of course, it's a segment tree problem.
![](https://codeforces.org/s/86312/android-icon-192x192.png)
G. To Go Or Not To Go?
I solved similar problem before. Do BFS from starting and ending point first. Then we consider if use the transport portal or not. I remember last time, I also get TLE by using Dijkstra.
![](http://codeforces.org/s/92853/android-icon-192x192.png)