#K62537. Pair Sum Finder

    ID: 31553 Type: Default 1000ms 256MiB

Pair Sum Finder

Pair Sum Finder

You are given an integer n representing the number of elements in an array, followed by n space‐separated integers, and an integer target. Your task is to determine whether there exist two distinct indices i and j such that:

\[ arr[i] + arr[j] = target \]

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

Note that the pair must consist of two different elements.

inputFormat

The input is given via standard input and consists of three lines:

  1. The first line contains an integer n, the number of elements in the array.
  2. The second line contains n space-separated integers representing the array.
  3. The third line contains an integer target, the target sum.

outputFormat

Output a single integer to standard output: 1 if there exist two distinct indices i and j such that arr[i] + arr[j] = target, otherwise 0.

## sample
5
1 2 3 4 5
7
1

</p>