In many constructive algorithm problems, the first or second test case often reveals the intended construction almost immediately.
When you don't get AC on your first attempt, it's natural to look at the test cases and see which one your code fails on. But sometimes, that test case contains the exact array or string that you were supposed to construct. Once you see it, the solution becomes much easier—you can simply figure out how to reproduce that construction in your code.
In my opinion, that's a bad way to learn constructive problems.
The problem is that you aren't really learning how to construct an array or string that satisfies the statement. Instead, you're learning how to recognize an already-made construction and translate it into code.
That might help you get AC, but it doesn't necessarily help you in a contest. During a contest, you won't have a test case sitting in front of you that gives away the construction.
I think a better approach is to try to derive the construction yourself before looking at the failing test case. Think about the conditions, experiment with small examples, look for patterns, and prove why your construction works.
After all, the valuable skill in constructive problems isn't memorizing constructions. It's learning how to construct something from the conditions given in the problem.








i think most of the time authors just put the most random solutions in the sample
Not the sample I meant test-cases
You can't look at the testcase while doing contest. And also, looking at the testcases that you got WA while you are practicing is not a good way to practice constructive problem either.