SMPSEQ6 - Fun with Sequences (Act 4)


You are given S - a sequence of n integers S = s1, s2 ... sn, Q - a sequence of n integers Q = q1, q2 ... qn and a nonnegative parameter x.

Please print in ascending order all such i, that si = qi+y, where -x <= y <= x.

Input data specification

In the first line you are given two integers 2 <= n <= 100, 0 <= x < n and in the following two lines n integers in each of the line:
-100 <= si, qi <= 100

Output data specification

The sequence of requested integers separated by spaces.

Example 1

Input:
5 2
-1 2 -1 1 -1
3 -2 -1 1 2

Output:
1 3 4 5

Example 2

Input:
6 4
-1 2 2 2 2 -2
3 -2 3 3 3 -1

Output:
6

Example 3

Input:
6 0
-1 2 10 12 6 -2
2 -2 10 21 6 -1
 
Output:
3 5

hide comments
le_hue_369: 2020-04-12 01:53:29

AC in the first go!! it made a novice programmer like me feels confident.

adamos_2134: 2019-08-29 12:34:10

how i can understand the notation -x <= y <= x

Last edit: 2019-08-29 12:34:38
krish_47: 2018-11-29 09:38:59

Nice problem, AC in one go...

guilheramos: 2017-12-19 20:35:25

This is a really nice problem

kass_97: 2017-01-13 11:31:08

AC at once, easy.....just put your brain to work a bit :p


Added by:kuszi
Date:2013-11-15
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64