For this problem https://mirror.codeforces.com/gym/103708/problem/G, the "proper" way to solve it is to use Multi Dimensional Ternary Search (https://mirror.codeforces.com/blog/entry/98524).
If I were to solve it with random search (it passes: https://mirror.codeforces.com/gym/103708/submission/274048924 — very much easily), would this be considered a valid solution? I feel like saying no would invalidate the use of string / polynomial hashing but saying yes feels very much wrong. What are your opinions?