Files
lincodex/runner/testdata/judge/python/pair_correct.py
T

13 lines
387 B
Python

# Prints any pair of 1-based positions whose values add up to the target.
import sys
lines = sys.stdin.read().split("\n")
target = int(lines[0])
values = [int(token) for token in lines[1].split()]
seen = {}
for position, value in enumerate(values, start=1):
if target - value in seen:
print(seen[target - value], position)
break
seen.setdefault(value, position)