Hank and Steven's quest

0

0 votes
Easy
Problem

Hank Schrader and Steven Gomez are DEA officers who are in the quest for catching the drug lord, Heisenberg, who is actually Hank's brother-in-law Walter White!

enter image description here

To complete this mission, they are loading crates containing ammunition inside a truck. The N crates are of different weights, and are numbered from 1,2,3...N.

The weights are represented as W1,W1....WN

While loading the crates, they want the absolute value of the difference between the weights of Pth and Qth crate

INPUT

  • First line contains an integer T, the number of Test Cases.
  • Each test case consists of 3 lines.
  • The first line denoted an integer N, the number of crates
  • The second line contains N space separated integers denoting the weights of N crates.
  • The third line contains 2 space separated integers P and Q.

OUTPUT

  • Output the answer of each test case in a separate line.

CONSTRAINTS

  • 1 ≤ T ≤ 106
  • 1 ≤ N ≤ 106
  • 1 ≤ T*N ≤ 106
  • 1 ≤ P,Q ≤ N
  • 1 ≤ w[i] ≤ 109
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?