#K8691. Pair Sum Existence Checker

    ID: 36969 Type: Default 1000ms 256MiB

Pair Sum Existence Checker

Pair Sum Existence Checker

Given an array of integers and a target integer k, determine whether there exist two distinct indices i and j in the array such that:

\( A[i] + A[j] = k \)

If such a pair exists, print 1; otherwise, print 0.

Note that the indices must be distinct, and the same element cannot be used twice.

inputFormat

The first line contains two space-separated integers n and k, where n is the number of elements in the array and k is the target sum. The second line contains n space-separated integers representing the array elements.

outputFormat

Output a single integer: 1 if a pair exists whose sum is k, otherwise 0.## sample

5 9
1 2 3 4 5
1