mirror of
https://github.com/mx42/codingame.git
synced 2026-01-14 05:39:51 +01:00
15 lines
368 B
Bash
15 lines
368 B
Bash
# https://www.codingame.com/ide/puzzle/horse-racing-duals
|
|
# Xavier Morel - 2016-03-12
|
|
|
|
# WIP: Only passing tests up to 55% : big performance issues, obviously...
|
|
|
|
read N
|
|
for ((i=0; i<N; i++)); do
|
|
read Pi
|
|
if ((i>0)); then
|
|
horses+=":"
|
|
fi
|
|
horses+=$Pi
|
|
done
|
|
echo $horses | tr ":" "\n" | sort -n | awk 'NR>1{print $1-p} {p=$1}' | sort -n | head -n 1
|