SMPSEQ9 - Fun with Sequences (Act 7)

You are given a sequence of n integers S = s1, s2 ... sn and a sequence of m integers Q = q1, q2 ... qm. If (q1 + q2 + ... + qm)/m < (s1 + s2 + ... + sn)/n please print the sequence S and otherwise please print the sequence 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.

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

Output data specification

The sequence of requested integers separated by spaces in the same order as in the input.

Example 1

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

Output:
-2 -1 0 1 4

Example 2

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

Output:
-2 -1 1 2 3

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

hide comments
2021-06-25 08:49:19 kuszi
@alelito thank you, fixed.
2021-04-21 18:06:25
There is an issue with Example 2. Correct output should be "-2 -1 1 2 3".
2020-07-03 19:27:03
what about the decimal values like upto how many places should the values be taken
2020-03-04 11:24:19
you can submit the answer what you understand in the question...
2020-02-16 16:42:57
yes 2nd example is wrong at the time i'm compiling
2019-12-28 17:14:02 kuszi
Example 2 was wrong - thank you for pointing this (fixed). What is wrong with Example 1?
2019-10-17 09:08:58
The sample test answers are wrong.So don't get confused and just stick onto the problem condition
2019-09-28 18:40:54
it is giving wrong answer on 5th test case. how to check what was that input. any idea?
2018-07-12 10:20:57
This sample output given is wrong to the given question
2017-01-13 12:17:19
Just changed one line in act 6 and green light :D
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.