Invalid constraints in POSAND

The problem POSAND has contradictory constraints. First it says 1<=i<N. Which clearly implies N>1, and it makes sense as well. But, in the bottom it takes the constraints as 1<=N<=10^5 . I mean how can you take N=1? It doesn’t even make sense and it violates the constraints above. If you are taking N=1, the answer should be -1 not 1. Because it just doesn’t satisfy the condition of the problem. This has cost me 50 points, and 3k ranks, and an obvious rating loss. Either correct the solution or give it a bonus.

3 Likes

Exactly I agree with you I spent 3 days on these problem untill I just randomly changed the condition for n==1 (I assumed it to be -1 which gave WA). I could have solved other problems in this time period !!.

1 Like

Yeah. Hope they re judge the solutions with the corrected testcases with the n=1 case removed.

1 Like

I thought the same initially but I got a partial correct for that, I randomly just changed the condition and it worked for me. Can setter please tell why is N = 1 possible?

1 Like

@abelyan Please See

I agree that there is problem in the constraints. The author should have mentioned, “For each valid i” instead of 1 \leq i < N.

Are you new to codechef? Nothing’s gonna happen. In the worst case thay would correct the test cases of the problem in practice section. But they won’t do a rejudge.

That’s sad. I rarely solve on Codechef. This actually discourages me to participate here. Add to this, plagiarism and cheating by various contestants.

My first submission no cd’n for n==1 PC
My second solution n==1 ans = 1; AC
So maybe that tricked you but if you have enough experience on several platforms then these mistakes are not considered for re-evaluation, Just it builds a node in your mind that this can happen as well + Always use the comment section bellow a problem if would have mentioned there it would have been corrected. This also a part of learning bro!

2 Likes

Did no one ask this in the comment section of POSAND? N=1 case seems ambiguous

Hello, I am sorry if that seemed a little confusing, I guess I could have written it better. But I didn’t write anything wrong; the statement says “for each 1≤i<N …” it doesn’t actually say 1≤N, that sentence talks about all the values of i that satisfy 1≤i<N and if N=1 there are no such values of i.

Yeah. So the testcases are wrong. N=1 should have -1 as the answer. Whereas you have given 1.

And you have given N>=1 in the bottom.

Nope, the test cases are not wrong. As I said there is no i that satisfies 1<=i<N if N=1 that means there are no conditions on the permutation, which means permutation [1] is acceptable.

If there is no i that satisfies 1<=i<N for N=1, how do you check the condition for N=1? How is it a valid permutation when it doesn’t even satisfy the condition?

In the problem it is mentioned that any permutation that satisfies that condition is a valid permutation. How does it become acceptable if it doesn’t satisfy the condition?

The problem says for each i that satisfies 1<=i<N the permutation we construct should satisfy a[i]&a[i+1]>0. So for N=3 there are two conditions on the permutation (a[1]&a[2]>0 and a[2]&a[3]>0), because there are only 2 values of i that satisfy 1<=i<3. In case of N=1 there are no conditions on the permutation (because there are no values of i that satisfy 1<=i<1) so any permutation is acceptable.

1 Like

That still doesn’t make sense. You are twisting the original problem statement.
The original statement said: " A permutation p1,p2…pN is beautiful if pi&pi+1 is greater than 0 for every 1≤i<N . You are given an integer N, and your task is to construct a beautiful permutation of length N or determine that it’s impossible".

While your argument would have made sense if the problem statement said: " A permutation p1,p2…pN is not beautiful if pi&pi+1 is equal to 0 for any 1≤i<N . You are given an integer N, and your task is to construct a beautiful permutation of length N or determine that it’s impossible"

I should have written > instead of = in my last reply. I have edited my last reply to not cause confusion. But still it was a minor thing and didn’t change the general idea of my last reply.