Fixed points

Let S = x₁, …, x_(n) be a sequence of integer numbers such that
x₁ < … < x_(n). For every integer number a and every index 1 ≤ i ≤ n,
define f_(a)(i) = x_(i) + a. Write a program that, given S and a, tells
whether there is some i such that f_(a)(i) = i.

Input

Input consists of several cases. Every case begins with n, followed by
S, followed by a number m, followed by m different integer numbers
a₁, …, a_(m). Assume 1 ≤ n ≤ 10⁶.

Output

For every case, print its number starting at 1. Afterwards, for every
a_(j) print the position of its fixed point. If no fixed point exists,
state so. If there is more than one fixed point, print the smallest one.
Print a blank line after the output for every case.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:22:29.729Z

© Jutge.org, 2006–2026.
https://jutge.org
