Skip to content

Instantly share code, notes, and snippets.

@yuikns
Last active August 29, 2015 14:24
Show Gist options
  • Save yuikns/54cb67e00ffb5bbe83ae to your computer and use it in GitHub Desktop.
Save yuikns/54cb67e00ffb5bbe83ae to your computer and use it in GitHub Desktop.
object Solution {
def main(args: Array[String]): Unit = {
val n = Console.in.readLine().toInt
val sl = (1 to n).map(i => (Console.in.readLine(),i))
//io.Source.stdin.getLines().take(1).map(_.toInt)
println(math.abs(sl.par.foldLeft(0){(l,e) =>
val i = e._2 - 1
val arr = e._1.split(" ")
l + arr(i).toInt - arr(n - i - 1).toInt
}))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment