SMPSEQ3 - Fun with Sequences


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

Please print in ascending order all such si that does not belong to Q.

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 integers separated by spaces.

Example

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

Output:
0 4

hide comments
ru0gg444: 2022-10-16 17:59:58

n and m be should generated randomly or entered by the user?
i generated randomly with given range. but it does not accepted

wrathcyber: 2022-05-20 18:22:11

use a set lol

pranab19: 2020-08-23 06:44:40

Stl binary search & vector....

rahatkhan99: 2019-11-28 06:47:29

just run a nested loop and check if first array is present in the second array.. if not, then print.. solved

swaraj007: 2019-02-15 22:41:08

simple set difference operation

akshayawate007: 2018-11-27 12:20:07

how to print unique elements>

jonmanu: 2018-08-10 15:29:49

my code is working pretty fine in devc++ but i am getting WA in spoj .dont know why? any suggestions?

Last edit: 2018-08-10 15:30:10
taidev198: 2018-04-21 06:33:31

anjali1998:please check size of arr1 and arr2

abhi_code_deep: 2017-12-15 11:24:54

Sorry.

Last edit: 2017-12-15 11:25:26
vishwanath_26: 2017-07-19 04:18:27

AC in one go!


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