Wrong answer in samesnak?

This is link to my solution for SAMESNAK problem asked in qualifier of codechef snackdown 2017. I am not able to figure out why I am getting the wrong answer. Any one please help me with this.

@vijju123

It’s clearly visible that it’s range falls in integer. Why do you want me to try with long.

Caught the problem.

Input
1
10 4 1 4
4 4 4 4
Output
yes

Correct output. But what if i tweak it to-

Input
1
4 4 4 4
10 4 1 4
Output
no
Expected Output
yes (same as previous)

@vijju123

Thanks buddy, got ac.

I am glad it helped dear :slight_smile: