SMPSEQ5 - Fun with Sequences (Act 3)

You are given a sequence of n integers S = s1, s2 ... sn and a sequence of m integers Q = q1, q2 ... qm.

Please print in ascending order all such i, that si = qi, i<=n, i<=m.

Input data specification

In the first line you are given one integer 2 <= n <= 100, and in the following line n integers:
-100 <= si <= 100, si <= si+1.

In the third line you are given one integer 2 <= m <= 100, and in the following line m integers:
-100 <= qi <= 100, qi <= qi+1.

Output data specification

The sequence of requested indexes separated by spaces.

Example 1

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

Output:
2 3 4

Example 2

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

Output:
4

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

hide comments
2016-09-23 12:08:06
print in the ascending order all such " i " <<this mean print "index" not "value"
Input:
a[1] a[2] a[3] a[4] a[5]
-2 -2 -1 1 4
b[1] b[2] b[3] b[4] b[5] b[6]
-3 -2 -1 1 2 3
since, a[2]==b[2], a[3]==b[3],a[4]==b[4]
output:
2 3 4
2016-08-28 08:28:01
can somebody explain??? if s(i) =q(i) then answer should have been
-2 -1 1
why is this not happening???

Last edit: 2016-08-28 08:28:25
2016-08-20 16:56:47
haah? i don't get it :(

edited : oh i got it hahah, i missed the description

Last edit: 2016-08-20 16:58:02
2016-07-31 07:34:30
Ac in first go but in my problems i did not get any points
2016-06-09 10:03:22
my code runs perfectly in C++ but gives WA on submission
2016-02-11 12:00:49
Example is correct, index should start from 1
AC in first submit ;)
2016-02-08 09:57:56
is the example missed -3?

Last edit: 2016-02-08 09:58:15
2015-12-24 08:34:33
Ain't the example misleading ?
2015-10-29 19:08:00
@akm_980 It seems to be correct! :)

Last edit: 2015-10-29 19:09:01
2015-10-18 14:06:49
I got it...
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.