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

hide comments
square1001: 2016-07-22 04:02:38

I changed only 4 bytes to my solution in SMPSEQ8.

ruizhang: 2016-06-10 22:01:00

The sample output is incorrect.

Amrinder Singh Brar: 2016-05-26 13:03:08

The outputs in examples are opposite of what is required in the question.

Arnab Animesh Das: 2015-12-27 22:34:28

Fix the outputs of the examples (the other one will be the answer), it caused me to get Wrong Answer.


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