#K95462. Pair Sum Possibility
Pair Sum Possibility
Pair Sum Possibility
You are given a list of integers and a target integer \( T \). Your task is to determine whether there exists a pair of distinct integers in the list whose sum equals \( T \). If such a pair exists, print POSSIBLE
; otherwise, print IMPOSSIBLE
.
Note: Two integers are considered distinct if they are at different positions in the list even if they have the same value.
Example:
- Input:
4 9
followed by2 7 11 15
- Output:
POSSIBLE
Use efficient methods as the input list can be large.
inputFormat
The first line of input contains two integers \( n \) and \( T \), where \( n \) denotes the number of elements in the list and \( T \) is the target sum.
The second line contains \( n \) space-separated integers.
outputFormat
Output a single line with the string POSSIBLE
if there exists a pair of distinct integers such that their sum equals \( T \); otherwise, output IMPOSSIBLE
.
4 9
2 7 11 15
POSSIBLE