# [SOLUTION] Save Sattu solution codechef 2021 – Spider AlgoCup Codechef

## Save Sattu solution codechef 2021

Sattu’s friend Priya is angry with him as he didn’t help her in the previous Spider Contest. This time Sattu wants to do this question for her, so that she forgives him.

You are given an array AA of numbers from 11 to NN, that is , the array has NN distinct numbers from 11 to NN and two numbers pp and qq.

Your task is to determine subsequences such that for any 2 numbers, XX and YY , in the subsequence , 4 conditions hold always true:

• XYpX−Y≠p
• YXpY−X≠p
• XYqX−Y≠q
• YXqY−X≠q

Print the length of the longest subsequence which holds these conditions.

SubsequenceSubsequence is a sequence that can be derived by deleting some or no elements from an Array without changing the order of the remaining elements.

### Input: Save Sattu solution codechef 2021

• First line will contain TT, number of testcases. Then the testcases follow.
• Each testcase contains of a single line of input, three integers N,p,qN,p,q.

### Output: Save Sattu solution codechef 2021

For each testcase, output in a single line the length of the longest subsequence which holds the above conditions.

### Constraints: Save Sattu solution codechef 2021

• 1T101≤T≤10
• 1N1081≤N≤108
• 1p,q201≤p,q≤20

### Sample Input: Save Sattu solution codechef 2021

2
10 2 5
21 4 6


### Sample Output: Save Sattu solution codechef 2021

5
9