Mock CCC '18 Contest 3 J4/S2 - A Median Problem

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Given N sequences of N integers, compute the median of the medians of the N sequences.

Constraints

1 \le N \le 99

N is odd.

Every integer in any of the sequences is between 1 and 10^6.

Input Specification

The first line contains a single positive integer, N.

Each of the next N lines contains exactly N positive integers, the N integers in one of the sequences.

Output Specification

Output, on a single line, the median of the medians of the N sequences.

Sample Input

3
1 2 3
4 5 6
7 8 9

Sample Output

5

Comments

There are no comments at the moment.