#K83647. Pair Sum Existence

    ID: 36244 Type: Default 1000ms 256MiB

Pair Sum Existence

Pair Sum Existence

Given an array of integers and a target integer, determine if there exist two distinct elements in the array whose sum equals the target value.

You are given an integer \(n\) representing the number of elements in the array, followed by \(n\) integers denoting the array elements and finally an integer \(T\) (target). Your task is to check whether there exists a pair \((a_i, a_j)\) with \(i \neq j\) such that \(a_i + a_j = T\). For example, if the array is [1, 2, 3, 9, 8] and \(T=10\), then the answer is true because \(2 + 8 = 10\>.

inputFormat

The input is provided via standard input (stdin) in the following format:

n
a1 a2 a3 ... an
T

Where:

  • n is an integer representing the number of elements in the array.
  • a1, a2, ..., an are integers representing the array elements.
  • T is the target sum.

outputFormat

Output a single line to standard output (stdout) that is either True if there exists a pair of distinct elements that sum to the target, or False otherwise.

## sample
5
1 2 3 9 8
10
True