### University of Toronto ACM-ICPC Tryouts 2013

## A: A Research Project

The school year has just begun, so it's time for Alice to find a suitable boyfriend! Naturally, this process will first require some careful research using a convenient online academic source known as Facebook.

Alice is considering `G` (1 ≤ `G` ≤ 100) guys, and wants to estimate how well-matched she would be with each of them - in other words, how attractive each of them is. For each guy, Alice can find `N` (1 ≤ `N` ≤ 100) pictures of him on Facebook, the `i`-th of which has attractiveness `A _{i}` (1 ≤

`A`≤ 100). The guy might be as ugly as his least-attractive picture (the one with the smallest attractiveness value), or as hot as his most-attractive picture.

_{i}In making her important and complex decision, Alice would like to know the potential range of attractiveness of each of the `G` potential guys!

### Input

Line 1: 1 integer, `G`

**For each guy:**

Line 1: 1 integer, `N`

Line 2: `N` integers, `A`_{1..N
}

### Output

For each guy, output 2 integers, the guy's worst-case and best-case attractiveness, respectively.

### Sample Input

3 4 2 5 1 3 1 98 5 16 11 11 14 21

### Sample Output

1 5 98 98 11 21

### Explanation of Sample

The first guy's worst picture (his third) has attractiveness 1, while his best (his second) has attractiveness 5.

The second guy has only one picture, making his attractiveness definitely 98.

Finally, the third guy's worst-case attractiveness is 11 (with two of his pictures having this value), while his best is 21.

All Submissions

Best Solutions

**Point Value:** 5

**Time Limit:** 2.00s

**Memory Limit:** 64M

**Added:** Jul 08, 2014

**Author:** SourSpinach

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

magicalsoupon Jun 23, 2018 - 1:45:42 am UTC Re: helpI ran the test cases on your code and it seems the problem is either when your are reading your code or when you are trying to access the first and last numbers of the array, you might want to check over on these areas, and i suggest you make your code a bit clearer and not take shortcuts, so its either when debugging your code, and last advice is to rubber-ducking your code, it should work for this problem. Hope you solve the problem

Mike22on Jun 23, 2018 - 1:21:05 am UTC helplists = []

for i in range(int(input())):

no_point = input()

my_storage = [x for x in input().split()]

my_storage.sort()

lists.append(my_storage[0] + ' ' + my_storage[-1])

print('\n'.join(lists))

shehanaton Mar 31, 2017 - 3:36:23 pm UTC NEED HELPThank You

JP16on Mar 05, 2016 - 5:54:39 am UTC whats wrong with my soln ...jargonon Mar 05, 2016 - 9:19:46 am UTC Re: whats wrong with my soln ...