Dear CodeChef Team,
I am writing to respectfully appeal the recent plagiarism flag on my submission for the problem “Front or Back” in Starters 184. I would like to explain how I independently arrived at my solution and clarify that I did not do any unfair means or copy anyone else’s code
My Approach :
Each person reports the number of people ahead of them in the direction they are facing.
We have to determine the number of valid permutations of people in the queue such that their observations match the provided list.
If a person reports A[i], it must be between 0 and N - 1.
We can’t have more than 2 people reporting the same value A[i] = x unless x == N, because people could be looking from the front or back, and only two people at max can report the same number: one from the front, one from the back.
I used a frequency array f to count how many times each value from 0 to N-1 occurs.
If a number appears more than 2 times, I immediately mark the case as invalid.
For any position p, its mirror index from the back is q = N - 1 - p.
I checked the total frequency of both positions (f[p] + f[q]). If it’s more than 2, it is invalid.
If there is at least one person among p and q, then it contributes 2 choices (they could be placed at p or q), so I multiply the answer by 2.
If N is odd, the middle position (N//2) must not appear more than once.
This is a common edge case that I handled with a condition.
As the answer can be large, I used modulo 998244353 as per the problem.
I know my code might look like someone else’s, but I didn’t copy it. The reason it looks similar is because There are only a few good ways to solve this problem, so many people might use the same idea.
By Using a frequency array to count values, checking from both ends of the list and using modulo are natural and common steps for this kind of question.
I used short variable names like f, p, q, and ans because I always do that during contests to save time.
I honestly wrote this code by myself and solved it step by step. I did not copy from anyone.
I kindly request the CodeChef team to review my explanation and reconsider the plagiarism flag on my submission.
Thank you for your time and understanding.
Sincerely,
Balusu Siva Harshitha
sivaharshitha
Starters 184 (Rated) : Submission id