<PREV Problem:
NEXT>
Solved by 2987 users: ...
UserDateAttemptTimeCMSC
Nakilon24 apr 2010Ruby1200.0217 
Nakilon08 jan 2010Ruby700.0219 
Nakilon08 jan 2010Ruby1100.0219 
uru15 feb 2009Ruby1200.0219 
Nakilon08 jan 2010Ruby500.0220 
Nakilon08 jan 2010Ruby600.0220 
kronos14 sep 2009Ruby1500.0220 
uru15 feb 2009Ruby1100.0221 
pav23 aug 2009Ruby2700.0221 
pav23 aug 2009Ruby3000.0221 
kronos13 sep 2009Ruby1400.0222 
V.A.KeRneL06 feb 2007Ruby1600.0222 
pav23 aug 2009Ruby2500.0222 
pav23 aug 2009Ruby2600.0222 
UlyaNick24 mar 2009Ruby1000.0223 
V.A.KeRneL14 nov 2006Ruby1200.0223 
V.A.KeRneL06 feb 2007Ruby1300.0223 
UlyaNick24 mar 2009Ruby1300.0223 
V.A.KeRneL06 feb 2007Ruby1500.0223 
pav26 may 2008Ruby1500.0223 
sb3ar13 mar 2008Ruby1700.0223 
sb3ar13 mar 2008Ruby1800.0223 
sb3ar16 mar 2008Ruby1900.0223 
sb3ar11 dec 2007Ruby1300.0224 
UlyaNick24 mar 2009Ruby1200.0126 
V.A.KeRneL06 feb 2007Ruby1400.0226 
blackm00n10 oct 2007Ruby400.0227 
daniel.ugra09 jan 2007Ruby700.0228 
sb3ar12 jun 2007Ruby1200.0228 
kronos25 sep 2007Ruby1300.0228 
tass19 apr 2007Ruby100.0229 
kronos17 apr 2007Ruby500.0229 
Languages
C++
1479
FPC
643
C
536
Java
166
Ruby
78
Kylix
73
Python
51
Perl
19
Lua
9
Scheme
9
Haskell
3
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

Set Intersection

Time limit = 5 second(s)

Memory limit = 33000 Kb

Your task is to find the intersection of two sets of positive integers.

Input The input consists of two sets of positive integers A={a1, a2, ..., an} and B={b1, b2, ..., bk} represented as two whitespace-separated lists of numbers. Each list ends with -1, that serves as an end-of-set marker. Repetitions of elements are possible in the input, but not in the output. You may assume that 0 < ai, bi < 106 and that the sets A and B are of size less than 1000.

Output is list of numbers or word "empty" if intersection is empty.

Input#1
6 7 8 1 2 3 -1
4 3 2 1 1 -1
Output#1
1 2 3
Input#2
1 2 3 -1
4 4 5 5 6 6 -1
Output#2
empty

Author:
Voroztsov Artem

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 220ms

SW soft NIX
ID = 3.226.248.180