#K53772. Taco Problem: Pair with Sum

    ID: 29606 Type: Default 1000ms 256MiB

Taco Problem: Pair with Sum

Taco Problem: Pair with Sum

Given an array of integers and a target integer \(T\), determine if there exist two distinct elements in the array whose sum is exactly \(T\). In other words, check whether there exist two indices \(i\) and \(j\) (with \(i \neq j\)) such that \(a_i + a_j = T\).

The input is provided in the following format:

  • The first line contains an integer \(n\), representing the number of elements in the array.
  • The second line contains \(n\) space-separated integers.
  • The third line contains the integer \(T\) (the target sum).

The output should be true if such a pair exists, and false otherwise.

inputFormat

The input consists of three lines:

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

outputFormat

Output a single line with true if there exist two distinct elements whose sum equals \(T\), and false otherwise.

## sample
4
1 2 3 9
8
false