WRONG WRONG WRONG : why I'm getting Wrong Answer even my code is correct ? - RAINBOWA

c-plus-plus
cakewalk
easy
rainbowa
wrong-answer

#1

T=int(raw_input())
for i in range(T):
N=int(raw_input())
L=map(int,raw_input().split())
sum1=0
sum2=0
answer =1
for j in range(N):
if N%2==0 :
if j<=N/2-1 :
sum1=sum1+L[j]
else :
sum2=sum2+L[j]
if j<N/2-1 :
if L[j-1]!=L[j]-1 and L[j-1]!=L[j] :
answer = 0
if j>N/2 :
if L[j]!=L[j-1]-1 and L[j-1]!=L[j] :
answer = 0
else :
if j<N/2 :
sum1=sum1+L[j]
elif j>N/2 :
sum2 = sum2+L[j]
if j<N/2:
if L[j-1]!=L[j]-1 and L[j-1]!=L[j] :
answer = 0
if j>N/2 :
if L[j]!=L[j-1]-1 and L[j-1]!=L[j] :
answer = 0
if answer == 0 or sum1!=sum2 :
print “no”
else :
print “yes”

question link : https://www.codechef.com/problems/RAINBOWA