#K92052. Two Sum Indices

    ID: 38111 Type: Default 1000ms 256MiB

Two Sum Indices

Two Sum Indices

Given an array of distinct integers and a target integer \(T\), write a program that finds two distinct indices \(i\) and \(j\) (with \(i < j\)) such that:

\(nums[i] + nums[j] = T\)

If such a pair exists, output the indices in ascending order separated by a space. Otherwise, output None.

Note: The array can be empty or have only one element, in which case there is no valid pair.

inputFormat

The input is read from standard input (stdin) in the following format:

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

outputFormat

Output to standard output (stdout) a single line. If there exists a pair of indices \(i\) and \(j\) (with \(i < j\)) such that \(nums[i] + nums[j] = T\), print the two indices separated by a space. If no such pair exists, print None.

## sample
4
2 7 11 15
9
0 1